Page 1 of 1

how to make a mutual exclusion with OIL

Posted: Wed Jun 24, 2020 11:47 am
by faiez
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.

Re: how to make a mutual exclusion with OIL

Posted: Mon Jun 29, 2020 1:23 pm
by paolo.gai
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