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

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)

Detailed Description

This module provides abstraction for semaphores, where available.


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
Copyright (C) 2006-2009 Teluu Inc.