Mutex

<dmsdk/dlib/mutex.h>

API for platform independent mutex synchronization primitive.

DM_MUTEX_SCOPED_LOCK

macro for scope lifetime Mutex locking

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

PARAMETERS

mutex -

dmMutex::HMutex Mutex handle to lock.


dmMutex::Delete()

delete Mutex.

Deletes a HMutex.

PARAMETERS

mutex -

dmMutex::HMutex Mutex handle to delete.


dmMutex::HMutex

HMutex type definition

typedef struct Mutex* HMutex;


dmMutex::Lock()

lock Mutex.

Lock a HMutex, will block until mutex is unlocked if already locked elsewhere.

PARAMETERS

mutex -

dmMutex::HMutex Mutex handle to lock.


dmMutex::New()

create Mutex

Creates a new HMutex.

RETURN

mutex -

dmMutex::HMutex A new Mutex handle.


dmMutex::TryLock()

non-blocking lock of Mutex.

Tries to lock a HMutex, if mutex is already locked it will return false and continue without locking the mutex.

PARAMETERS

mutex -

dmMutex::HMutex Mutex handle to lock.

RETURN

result -

bool True if mutex was successfully locked, false otherwise.


dmMutex::Unlock()

unlock Mutex.

Unlock a HMutex.

PARAMETERS

mutex -

dmMutex::HMutex Mutex handle to unlock.