reactor-c 1.0
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
lf_semaphore_t Struct Reference

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.

Detailed Description

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.

Field Documentation

◆ cond

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.

◆ count

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.

◆ mutex

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.


The documentation for this struct was generated from the following file:
  • /Users/runner/work/reactor-c/reactor-c/include/core/utils/lf_semaphore.h