|
noexcept |
Creates a mutex object with the specified properties.
[in] | mtx | is a pointer to a location where the function is about to store a mutex descriptor on output. |
[in] | nType | is bit mask indicating a type of a mutex being created. It supports values of the chsv_mutex_constants enumeration. |
The function is implemented as an alternative to the mtx_init function defined by the ISO/IEC 9899:2011 (aka C11) standard and behaves exactly as the standard specifies. It uses own type of mutex (chsv_mtx_t), own set of possible return codes and mutex types but with respect to C11.
According to C11 the following types of a mutex object are supported:
Mutex type | Description |
---|---|
chsv_mtx_plain | A simple non-recursive mutex. |
chsv_mtx_timed | A non-recursive mutex with timeout support. |
chsv_mtx_try | A non-recursive mutex supporting test-and-run. |
chsv_mtx_plain | chsv_mtx_recursive | A simple recursive mutex. |
chsv_mtx_timed | chsv_mtx_recursive | A recursive mutex with timeout support. |
chsv_mtx_try | chsv_mtx_recursive | A recursive mutex supporting test-and-run. |
Use the chsv_mtx_destroy function to close the created mutex and free associated resources.