sipxportlib
Version 3.3
|
Lock class for mutual exclusion in a critical section. More...
#include <OsLock.h>
Public Types | |
enum | TakeStateEnum { Unknown, PreAcquire, PostAcquire, PostRelease } |
typedef enum OsLock::TakeStateEnum | OsLockTakeState |
Public Member Functions | |
OsLock (OsSyncBase &rSemaphore, void(*lockStateCallback)(OsLockTakeState state, void *data)=NULL, void *callbackData=NULL) | |
Constructor. More... | |
virtual | ~OsLock () |
Destructor. More... | |
Lock class for mutual exclusion in a critical section.
This class uses OsSyncBase objects for synchronization. The constructor for the class automatically blocks until the designated semaphore is acquired. Similarly, the destructor automatically releases the lock. The easiest way to use this object as a guard for a critical section is to create the object as a variable on the stack just before the critical section. When the variable goes out of scope, the lock will be automatically released. An example of this form of use is shown below.
someMethod()
{
OsLock lock(myBSemaphore);
< critical section >
}
typedef enum OsLock::TakeStateEnum OsLockTakeState |
enum TakeStateEnum |
|
inline |
Constructor.
|
inlinevirtual |
Destructor.