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

Reader/Writer Mutex
[Operating System Dependent Functionality.]


Detailed Description

Reader/writer mutex is a classic synchronization object where multiple readers can acquire the mutex, but only a single writer can acquire the mutex.


Typedefs

typedef struct pj_rwmutex_t pj_rwmutex_t

Functions

pj_status_t pj_rwmutex_create (pj_pool_t *pool, const char *name, pj_rwmutex_t **mutex)
pj_status_t pj_rwmutex_lock_read (pj_rwmutex_t *mutex)
pj_status_t pj_rwmutex_lock_write (pj_rwmutex_t *mutex)
pj_status_t pj_rwmutex_unlock_read (pj_rwmutex_t *mutex)
pj_status_t pj_rwmutex_unlock_write (pj_rwmutex_t *mutex)
pj_status_t pj_rwmutex_destroy (pj_rwmutex_t *mutex)


Typedef Documentation

typedef struct pj_rwmutex_t pj_rwmutex_t

Opaque declaration for reader/writer mutex. Reader/writer mutex is a classic synchronization object where multiple readers can acquire the mutex, but only a single writer can acquire the mutex.


Function Documentation

pj_status_t pj_rwmutex_create ( pj_pool_t pool,
const char *  name,
pj_rwmutex_t **  mutex 
)

Create reader/writer mutex.

Parameters:
pool Pool to allocate memory for the mutex.
name Name to be assigned to the mutex.
mutex Pointer to receive the newly created mutex.
Returns:
PJ_SUCCESS on success, or the error code.

pj_status_t pj_rwmutex_destroy ( pj_rwmutex_t mutex  ) 

Destroy reader/writer mutex.

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

pj_status_t pj_rwmutex_lock_read ( pj_rwmutex_t mutex  ) 

Lock the mutex for reading.

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

pj_status_t pj_rwmutex_lock_write ( pj_rwmutex_t mutex  ) 

Lock the mutex for writing.

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

pj_status_t pj_rwmutex_unlock_read ( pj_rwmutex_t mutex  ) 

Release read lock.

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

pj_status_t pj_rwmutex_unlock_write ( pj_rwmutex_t mutex  ) 

Release write 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