![]() |
reactor-c 1.0
C Runtime for Lingua Franca
|
A semaphore. More...
#include <lf_semaphore.h>
Data Fields | |
| lf_cond_t | cond |
| Condition variable used for blocking operations. | |
| size_t | count |
| The current count of the semaphore. | |
| lf_mutex_t | mutex |
| Mutex used to protect access to the count. | |
A semaphore.
A semaphore is a synchronization primitive that maintains a count. The count is decremented by acquire operations and incremented by release operations. If the count would become negative, the acquire operation blocks until the count becomes positive again.
| lf_cond_t lf_semaphore_t::cond |
Condition variable used for blocking operations.
Threads waiting for the semaphore to become available block on this condition variable.
| size_t lf_semaphore_t::count |
The current count of the semaphore.
This value is protected by the mutex and can be modified only while holding the mutex lock.
| lf_mutex_t lf_semaphore_t::mutex |
Mutex used to protect access to the count.
Ensures that count modifications are atomic and coordinates access between multiple threads.