Group PJ_SEM¶
-
group
PJ_SEM
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)¶ 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_wait
(pj_sem_t *sem)¶ Wait for 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_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_destroy
(pj_sem_t *sem)¶ Destroy semaphore.
- Parameters
sem – The semaphore.
- Returns
PJ_SUCCESS on success, or the error code.
-
pj_status_t