mxLock (Function) |
Top Previous Next |
The mxLock() function will lock the specified MUTEX variable. This mutex mechanism ensures that only one thread will continue to run between the call to mxLock() and mxUnlock(). If the mutex is already locked, the calling thread will be blocked on a FIFO waiting queue until the current owner of the mutex calls mxUnlock(). If the owner of the mutex calls mxLock() several times, it will not block, but the number of mxLock() and mxUnlock() called must balance, and the mutex will not be released before the last and closing call to mxUnlock() is performed.
The mutex mechanism is traditionally used for implementing critical sections. Also see the section on thread synchronization for more information.
Input: mx : MUTEX The MUTEX to lock.
Returns: INT
Declaration: FUNCTION mxLock : INT;
Example: INCLUDE rtcu.inc |