WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJLIB Reference

Enumerations

enum  pj_mutex_type_e { PJ_MUTEX_DEFAULT , PJ_MUTEX_SIMPLE , PJ_MUTEX_RECURSE }
 

Functions

pj_status_t pj_mutex_create (pj_pool_t *pool, const char *name, int type, pj_mutex_t **mutex)
 
pj_status_t pj_mutex_create_simple (pj_pool_t *pool, const char *name, pj_mutex_t **mutex)
 
pj_status_t pj_mutex_create_recursive (pj_pool_t *pool, const char *name, pj_mutex_t **mutex)
 
pj_status_t pj_mutex_lock (pj_mutex_t *mutex)
 
pj_status_t pj_mutex_unlock (pj_mutex_t *mutex)
 
pj_status_t pj_mutex_trylock (pj_mutex_t *mutex)
 
pj_status_t pj_mutex_destroy (pj_mutex_t *mutex)
 
pj_bool_t pj_mutex_is_locked (pj_mutex_t *mutex)
 

Detailed Description

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.

Enumeration Type Documentation

◆ pj_mutex_type_e

Mutex types:

  • PJ_MUTEX_DEFAULT: default mutex type, which is system dependent.
  • PJ_MUTEX_SIMPLE: non-recursive mutex.
  • PJ_MUTEX_RECURSE: recursive mutex.

Function Documentation

◆ pj_mutex_create()

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
poolThe pool.
nameName to be associated with the mutex (for debugging).
typeThe type of the mutex, of type pj_mutex_type_e.
mutexPointer to hold the returned mutex instance.
Returns
PJ_SUCCESS on success, or the error code.

◆ pj_mutex_create_recursive()

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
poolThe pool.
nameMutex name.
mutexPointer to hold the returned mutex instance.
Returns
PJ_SUCCESS on success, or the error code.

◆ pj_mutex_create_simple()

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
poolThe pool.
nameMutex name.
mutexPointer to hold the returned mutex instance.
Returns
PJ_SUCCESS on success, or the error code.

◆ pj_mutex_destroy()

pj_status_t pj_mutex_destroy ( pj_mutex_t mutex)

Destroy mutex.

Parameters
mutexTe mutex.
Returns
PJ_SUCCESS on success, or the error code.

◆ pj_mutex_is_locked()

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
mutexThe mutex.
Returns
Non-zero if yes.

◆ pj_mutex_lock()

pj_status_t pj_mutex_lock ( pj_mutex_t mutex)

Acquire mutex lock.

Parameters
mutexThe mutex.
Returns
PJ_SUCCESS on success, or the error code.

◆ pj_mutex_trylock()

pj_status_t pj_mutex_trylock ( pj_mutex_t mutex)

Try to acquire mutex lock.

Parameters
mutexThe mutex.
Returns
PJ_SUCCESS on success, or the error code if the lock couldn't be acquired.

◆ pj_mutex_unlock()

pj_status_t pj_mutex_unlock ( pj_mutex_t mutex)

Release mutex lock.

Parameters
mutexThe mutex.
Returns
PJ_SUCCESS on success, or the error code.

 


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.