Group PJ_MUTEX¶
- group PJ_MUTEX
Mutex manipulation. Alternatively, application can use higher abstraction for lock objects, which provides uniform API for all kinds of lock mechanisms, including mutex. See Lock Objects for more information.
Enums
Functions
-
pj_status_t pj_mutex_create(pj_pool_t *pool, const char *name, int type, pj_mutex_t **mutex)¶
Create mutex of the specified type.
- Parameters
pool – The pool.
name – Name to be associated with the mutex (for debugging).
type – The type of the mutex, of type pj_mutex_type_e.
mutex – Pointer to hold the returned mutex instance.
- Returns
PJ_SUCCESS on success, or the error code.
-
pj_status_t pj_mutex_create_simple(pj_pool_t *pool, const char *name, pj_mutex_t **mutex)¶
Create simple, non-recursive mutex. This function is a simple wrapper for pj_mutex_create to create non-recursive mutex.
- Parameters
pool – The pool.
name – Mutex name.
mutex – Pointer to hold the returned mutex instance.
- Returns
PJ_SUCCESS on success, or the error code.
-
pj_status_t pj_mutex_create_recursive(pj_pool_t *pool, const char *name, pj_mutex_t **mutex)¶
Create recursive mutex. This function is a simple wrapper for pj_mutex_create to create recursive mutex.
- Parameters
pool – The pool.
name – Mutex name.
mutex – Pointer to hold the returned mutex instance.
- Returns
PJ_SUCCESS on success, or the error code.
-
pj_status_t pj_mutex_lock(pj_mutex_t *mutex)¶
Acquire mutex lock.
- Parameters
mutex – The mutex.
- Returns
PJ_SUCCESS on success, or the error code.
-
pj_status_t pj_mutex_unlock(pj_mutex_t *mutex)¶
Release mutex lock.
- Parameters
mutex – The mutex.
- Returns
PJ_SUCCESS on success, or the error code.
-
pj_status_t pj_mutex_trylock(pj_mutex_t *mutex)¶
Try to acquire mutex lock.
- Parameters
mutex – The mutex.
- Returns
PJ_SUCCESS on success, or the error code if the lock couldn’t be acquired.
-
pj_status_t pj_mutex_destroy(pj_mutex_t *mutex)¶
Destroy mutex.
- Parameters
mutex – Te mutex.
- Returns
PJ_SUCCESS on success, or the error code.
-
pj_bool_t pj_mutex_is_locked(pj_mutex_t *mutex)¶
Determine whether calling thread is owning the mutex (only available when PJ_DEBUG is set).
- Parameters
mutex – The mutex.
- Returns
Non-zero if yes.
-
pj_status_t pj_mutex_create(pj_pool_t *pool, const char *name, int type, pj_mutex_t **mutex)¶