API for platform independent mutex synchronization primitive.
Namespace: | dmMutex |
Include: | #include <dmsdk/dlib/mutex.h> |
TYPES | |
---|---|
dmMutex::HMutex | HMutex type definition |
FUNCTIONS | |
---|---|
void dmMutex::Delete(dmMutex::HMutex mutex) | delete Mutex. |
void dmMutex::Lock(dmMutex::HMutex mutex) | lock Mutex. |
dmMutex::HMutex dmMutex::New() | create Mutex |
bool dmMutex::TryLock(dmMutex::HMutex mutex) | non-blocking lock of Mutex. |
void dmMutex::Unlock(dmMutex::HMutex mutex) | unlock Mutex. |
MACROS | |
---|---|
DM_MUTEX_SCOPED_LOCK(mutex) | macro for scope lifetime Mutex locking |
void dmMutex::Delete(dmMutex::HMutex mutex)
Deletes a HMutex.
PARAMETERS
dmMutex::HMutex |
mutex |
Mutex handle to delete. |
void dmMutex::Lock(dmMutex::HMutex mutex)
Lock a HMutex, will block until mutex is unlocked if already locked elsewhere.
PARAMETERS
dmMutex::HMutex |
mutex |
Mutex handle to lock. |
dmMutex::HMutex dmMutex::New()
Creates a new HMutex.
PARAMETERS
RETURNS
dmMutex::HMutex |
A new Mutex handle. |
bool dmMutex::TryLock(dmMutex::HMutex mutex)
Tries to lock a HMutex, if mutex is already locked it will return false and continue without locking the mutex.
PARAMETERS
dmMutex::HMutex |
mutex |
Mutex handle to lock. |
RETURNS
bool |
True if mutex was successfully locked, false otherwise. |
void dmMutex::Unlock(dmMutex::HMutex mutex)
Unlock a HMutex.
PARAMETERS
dmMutex::HMutex |
mutex |
Mutex handle to unlock. |
typedef struct Mutex* HMutex;
Will lock a Mutex and automatically unlock it at the end of the scope.
mutex |
Mutex handle to lock. |