Thread Mutexes (Locks/Critical Sections)
◆ M_thread_mutex_t
◆ M_thread_mutexattr_t
Mutex attributes. Used for mutex creation.
Enumerator |
---|
M_THREAD_MUTEXATTR_NONE | None.
|
M_THREAD_MUTEXATTR_RECURSIVE | Mutex is recursive.
|
◆ M_thread_mutex_create()
Mutex create.
- Parameters
-
[in] | attr | M_thread_mutexattr_t attributes which control how the mutex should behave. |
- Returns
- Mutex on success otherwise NULL on error.
◆ M_thread_mutex_destroy()
Destroy a mutex.
- Parameters
-
◆ M_thread_mutex_lock()
Lock a mutex.
This will block until the mutex can be locked.
- Parameters
-
- Returns
- M_TRUE if the function returns due to a successful mutex lock. Otherwise M_FALSE on error. This can fail for a number of reasons, for example:
- The mutex was already locked by this thread.
- The mutex is invalid.
- The mutex has exceeded the maximum number of recursive locks.
◆ M_thread_mutex_trylock()
Try to lock the mutex.
Does not block waiting to lock the mutex.
- Parameters
-
- Returns
- M_TRUE if the mutex was locked. Otherwise M_FALSE.
◆ M_thread_mutex_unlock()
Unlock a locked mutex.
- Parameters
-
- Returns
- M_TRUE if the mutex was unlocked. Otherwise M_FALSE.