Inverse Semaphore definitions. More...
Inverse Semaphore definitions.
Inverse Semaphores can be used to synchronize on multiple
threads / objects.
The inverse semaphore can be used eiher in counter or in
mask mode.
### Counter Mode ###
In this mode the inverse Semaphore is initialized with a
counter variable `n`.
After `n` calls to @ref sema_inv_post, the waiting thread
is unblocked.
### Mask Mode ###
In this mode the inverse Semaphore is initialized with a
bit mask `n`.
A call to @ref sema_inv_post_mask clears one or multiple bits.
Clearing the same bit multiple times has no effect.
The thread is unblocked if all bits have been cleared.
Definition in file sema_inv.h.
Include dependency graph for sema_inv.h:Go to the source code of this file.
Data Structures | |
| struct | sema_inv_t |
| An Inverse Semaphore. More... | |
Functions | |
| bool | sema_inv_post (sema_inv_t *s) |
| Signal semaphore (counter mode). More... | |
| bool | sema_inv_post_mask (sema_inv_t *s, uint32_t mask) |
| Signal semaphore (mask mode). More... | |
| static void | sema_inv_init (sema_inv_t *s, uint32_t value) |
| Initialize an inverse semaphore. More... | |
| static void | sema_inv_wait (sema_inv_t *s) |
| Wait for the inverse semaphore value to reach zero. More... | |
| static int | sema_inv_try_wait (sema_inv_t *s) |
| Check if the inverse semaphore value has reached zero. More... | |
| static int | sema_inv_wait_timeout (sema_inv_t *s, uint32_t us) |
| Wait for the inverse semaphore value to reach zero or a timeout being reached. More... | |