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_sem_create()

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

Create semaphore.

Parameters
poolThe pool.
nameName to be assigned to the semaphore (for logging purpose)
initialThe initial count of the semaphore.
maxThe maximum count of the semaphore.
semPointer to hold the semaphore created.
Returns
PJ_SUCCESS on success, or the error code.

◆ pj_sem_destroy()

pj_status_t pj_sem_destroy ( pj_sem_t sem)

Destroy semaphore.

Parameters
semThe semaphore.
Returns
PJ_SUCCESS on success, or the error code.

◆ pj_sem_post()

pj_status_t pj_sem_post ( pj_sem_t sem)

Release semaphore.

Parameters
semThe semaphore.
Returns
PJ_SUCCESS on success, or the error code.

◆ pj_sem_trywait()

pj_status_t pj_sem_trywait ( pj_sem_t sem)

Try wait for semaphore.

Parameters
semThe semaphore.
Returns
PJ_SUCCESS on success, or the error code.

◆ pj_sem_wait()

pj_status_t pj_sem_wait ( pj_sem_t sem)

Wait for semaphore.

Parameters
semThe 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.