Skip to main content

switch_mutex_init

Function switch_mutex_init 

Source
pub unsafe extern "C" fn switch_mutex_init(
    lock: *mut *mut switch_mutex_t,
    flags: c_uint,
    pool: *mut switch_memory_pool_t,
) -> switch_status_t
Expand description

Create and initialize a mutex that can be used to synchronize threads. @param lock the memory address where the newly created mutex will be stored. @param flags Or’ed value of:

          SWITCH_THREAD_MUTEX_DEFAULT   platform-optimal lock behavior.
          SWITCH_THREAD_MUTEX_NESTED    enable nested (recursive) locks.
          SWITCH_THREAD_MUTEX_UNNESTED  disable nested locks (non-recursive).
@param pool the pool from which to allocate the mutex. @warning Be cautious in using SWITCH_THREAD_MUTEX_DEFAULT. While this is the most optimial mutex based on a given platform's performance charateristics, it will behave as either a nested or an unnested lock.