pjsip logo pjsip.org
Open source SIP stack and media stack for presence, im/instant messaging, and multimedia communication

HOME

SIP/media Features
High Performance SIP
Small Footprint SIP
Symbian Port

FAQ

Documentation

Licensing

Download

Development (Trac)

Projects using pjsip

Mailing List

Open Source Links


About: PJLIB, PJLIB-UTIL, PJSIP, and PJMEDIA are created by: Benny Prijono
<bennylp@pjsip.org>


 

Home --> Documentations --> PJLIB Reference

Mutexes.
[Operating System Dependent Functionality.]


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.


Defines

#define pj_mutex_is_locked(mutex)   1

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)


Define Documentation

#define pj_mutex_is_locked ( mutex   )     1

Determine whether calling thread is owning the mutex (only available when PJ_DEBUG is set).

Parameters:
mutex The mutex.
Returns:
Non-zero if yes.


Enumeration Type Documentation

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_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_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_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_destroy ( pj_mutex_t mutex  ) 

Destroy mutex.

Parameters:
mutex Te mutex.
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_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_unlock ( pj_mutex_t mutex  ) 

Release mutex lock.

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

 


PJLIB Open Source, high performance, small footprint, and very very portable framework
(C)2001-2008 Benny Prijono