#include <pthread.h>
#include <sys/time.h>
#include <errno.h>
#include "tsemaphore.h"
#include "user_debug_levels.h"
Go to the source code of this file.
Functions | |
void | tsem_init (tsem_t *tsem, unsigned int val) |
void | tsem_deinit (tsem_t *tsem) |
void | tsem_down (tsem_t *tsem) |
void | tsem_up (tsem_t *tsem) |
void | tsem_reset (tsem_t *tsem) |
void | tsem_wait (tsem_t *tsem) |
void | tsem_signal (tsem_t *tsem) |
void tsem_deinit | ( | tsem_t * | tsem | ) |
Destroy the semaphore
tsem | the semaphore to destroy |
Definition at line 52 of file test/components/common/tsemaphore.c.
References tsem_t::condition, and tsem_t::mutex.
void tsem_down | ( | tsem_t * | tsem | ) |
Decreases the value of the semaphore. Blocks if the semaphore value is zero.
tsem | the semaphore to decrease |
Definition at line 62 of file test/components/common/tsemaphore.c.
References tsem_t::condition, tsem_t::mutex, and tsem_t::semval.
void tsem_init | ( | tsem_t * | tsem, | |
unsigned int | val | |||
) |
Initializes the semaphore at a given value
tsem | the semaphore to initialize | |
val | the initial value of the semaphore |
Definition at line 42 of file test/components/common/tsemaphore.c.
References tsem_t::condition, tsem_t::mutex, and tsem_t::semval.
void tsem_reset | ( | tsem_t * | tsem | ) |
Reset the value of the semaphore
tsem | the semaphore to reset |
Definition at line 86 of file test/components/common/tsemaphore.c.
References tsem_t::mutex, and tsem_t::semval.
void tsem_signal | ( | tsem_t * | tsem | ) |
Signal the condition,if waiting
tsem | the semaphore to signal |
Definition at line 106 of file test/components/common/tsemaphore.c.
References tsem_t::condition, and tsem_t::mutex.
void tsem_up | ( | tsem_t * | tsem | ) |
Increases the value of the semaphore
tsem | the semaphore to increase |
Definition at line 75 of file test/components/common/tsemaphore.c.
References tsem_t::condition, tsem_t::mutex, and tsem_t::semval.
void tsem_wait | ( | tsem_t * | tsem | ) |
Wait on the condition.
tsem | the semaphore to wait |
Definition at line 96 of file test/components/common/tsemaphore.c.
References tsem_t::condition, and tsem_t::mutex.