#include <Synchronized.h>
Public Member Functions | |
int | take () |
int | give () |
Friends | |
class | Synchronized |
Wrap a vxWorks semaphore (SEM_ID) for easier use in C++. For a static instance, the constructor runs at program load time before main() can spawn any tasks. Use that to fix race conditions in setup code.
This uses a semM semaphore which is "reentrant" in the sense that the owning task can "take" the semaphore more than once. It will need to "give" the semaphore the same number of times to unlock it.
This class is safe to use in static variables because it does not depend on any other C++ static constructors or destructors.
|
inline |
Unlock the semaphore.
|
inline |
Lock the semaphore, blocking until it's available.