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

Semaphores.
[Operating System Dependent Functionality.]


Detailed Description

This module provides abstraction for semaphores, where available.


Functions

pj_status_t pj_sem_create (pj_pool_t *pool, const char *name, unsigned initial, unsigned max, pj_sem_t **sem)
pj_status_t pj_sem_wait (pj_sem_t *sem)
pj_status_t pj_sem_trywait (pj_sem_t *sem)
pj_status_t pj_sem_post (pj_sem_t *sem)
pj_status_t pj_sem_destroy (pj_sem_t *sem)


Function Documentation

pj_status_t pj_sem_create ( pj_pool_t pool,
const char *  name,
unsigned  initial,
unsigned  max,
pj_sem_t **  sem 
)

Create semaphore.

Parameters:
pool The pool.
name Name to be assigned to the semaphore (for logging purpose)
initial The initial count of the semaphore.
max The maximum count of the semaphore.
sem Pointer to hold the semaphore created.
Returns:
PJ_SUCCESS on success, or the error code.

pj_status_t pj_sem_destroy ( pj_sem_t sem  ) 

Destroy semaphore.

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

pj_status_t pj_sem_post ( pj_sem_t sem  ) 

Release semaphore.

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

pj_status_t pj_sem_trywait ( pj_sem_t sem  ) 

Try wait for semaphore.

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

pj_status_t pj_sem_wait ( pj_sem_t sem  ) 

Wait for semaphore.

Parameters:
sem The semaphore.
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