slavik262, Thanks for the explanation, but i knew that from the C_CPP_Programming_Guide.pdf.
I did some more looking about, and I found the Answer:
Code:
//Top of file after includes
SEM_ID robotLock = semMCreate(SEM_Q_PRIORITY);//this creates a lock for the use of myRobot
//in a function somewhere else
CRITICAL_REGION(robotLock);
myRobot.Drive(1.0,0.0);
END_REGION;
the robotLock variable is the lock that needs to be obtained for a safe procedure, but it is not neccesary. So someone could do this:
Code:
//Top of file after includes
SEM_ID robotLock = semMCreate(SEM_Q_PRIORITY);//this creates a lock for the use of myRobot
//in a function somewhere else
CRITICAL_REGION(robotLock);
myRobot.Drive(1.0,0.0);
END_REGION;
//more code and other functions of a very complex nature here
myRobot.Drive(0.5,0.0);//this will compile but be not safe
So you need to explicitly obtain a lock for the variable you want and have decided to use for it.
Thanks for everyone's help in leading me to the right answer