19 #ifndef ASTERISK_SEMAPHORE_H 20 #define ASTERISK_SEMAPHORE_H 31 #ifdef HAS_WORKING_SEMAPHORE 34 #include <semaphore.h> 40 #define AST_SEM_VALUE_MAX SEM_VALUE_MAX 46 return sem_init(&sem->real_sem, pshared, value);
51 return sem_destroy(&sem->real_sem);
56 return sem_post(&sem->real_sem);
61 return sem_wait(&sem->real_sem);
66 return sem_timedwait(&sem->real_sem, abs_timeout);
71 return sem_getvalue(&sem->real_sem, sval);
92 #define AST_SEM_VALUE_MAX INT_MAX Asterisk locking-related definitions:
int ast_sem_destroy(struct ast_sem *sem)
Destroy a semaphore.
int ast_sem_post(struct ast_sem *sem)
Increments the semaphore, unblocking a waiter if necessary.
int ast_sem_timedwait(struct ast_sem *sem, const struct timespec *abs_timeout)
Decrements the semaphore, waiting until abs_timeout.
pthread_cond_t ast_cond_t
int ast_sem_getvalue(struct ast_sem *sem, int *sval)
Gets the current value of the semaphore.
int ast_sem_wait(struct ast_sem *sem)
Decrements the semaphore.
int ast_sem_init(struct ast_sem *sem, int pshared, unsigned int value)
Initialize a semaphore.
Structure for mutex and tracking information.