how to make a mutual exclusion with OIL

Forum related to ERIKA Enterprise and RT-Druid version 2

Moderator: paolo.gai

Post Reply
faiez
Newbie
Posts: 1
Joined: Sat Mar 07, 2020 2:19 pm

how to make a mutual exclusion with OIL

Post by faiez » Wed Jun 24, 2020 11:47 am

Hello,

I am trying to implement a mutual exclusion with OIL , i read that i have to use RESOURCE and its predefined APIs (DeclareResource(); GetResource(); ReleaseResource(); ) to protect critical sections.
i have declared my resource as follow :
conf.oil file :

Code: Select all

 RESOURCE mymutex { RESOURCEPROPERTY = STANDARD; }; 

Code: Select all

	TASK TaskReceive {
		PRIORITY = 0x01;   /* High priority */
		AUTOSTART = FALSE;
		STACK = SHARED;
		ACTIVATION = 1;    /* only one pending activation */
		SCHEDULE = FULL;
		RESOURCE = mymutex ;
	};
Code.c file :

Code: Select all

DeclareResource(mymutex);
i am getting the following error :
make all
Using erika files in /home/evidence/Erika_SVN/
CC code.c
In file included from /home/evidence/Erika_SVN//pkg/ee.h:50:0,
from code.c:41:
./eecfg.h:23:21: error: expected declaration specifiers or '...' before numeric constant
#define mymutex 1U
^
code.c:77:17: note: in expansion of macro 'mymutex'
DeclareResource(mymutex);
^
make: *** [obj/code.o] Error 1
is there any missing part in the RESOURCE declaration ? and what makes DeclareResource() showing the error above ?
ps : Many thanks in advance for your help, i am a beginner.

paolo.gai
Administrator
Posts: 864
Joined: Thu Dec 07, 2006 12:11 pm

Re: how to make a mutual exclusion with OIL

Post by paolo.gai » Mon Jun 29, 2020 1:23 pm

Hmmm... quite strange. Please remove DeclareResource, it is not needed as it is by default in the ee.h.

We'll check why this is happening.

PJ

Post Reply