Sdk mutex api documentation

API for platform independent mutex synchronization primitive.

Namespace: dmMutex
Include: #include <dmsdk/dlib/mutex.h>
FUNCTIONS
dmMutex::HMutex dmMutex::New() create Mutex
void dmMutex::Delete(dmMutex::HMutex mutex) delete Mutex.
void dmMutex::Lock(dmMutex::HMutex mutex) lock 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

Functions

dmMutex::New

dmMutex::HMutex dmMutex::New()

Creates a new HMutex.

PARAMETERS

RETURNS

dmMutex::HMutex A new Mutex handle.

dmMutex::Delete

void dmMutex::Delete(dmMutex::HMutex mutex)

Deletes a HMutex.

PARAMETERS

dmMutex::HMutex mutex Mutex handle to delete.

dmMutex::Lock

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::TryLock

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.

dmMutex::Unlock

void dmMutex::Unlock(dmMutex::HMutex mutex)

Unlock a HMutex.

PARAMETERS

dmMutex::HMutex mutex Mutex handle to unlock.

Macros

DM_MUTEX_SCOPED_LOCK

macro for scope lifetime Mutex locking

Will lock a Mutex and automatically unlock it at the end of the scope.

mutex Mutex handle to lock.