oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Functions
Synchronisation primitives

Mutex, counting semaphore, binary event, recursive mutex, and condition variable APIs. More...

Functions

OVE_NODISCARD int ove_mutex_init (ove_mutex_t *mtx, ove_mutex_storage_t *storage) OVE_NONNULL(1
 Initialise a non-recursive mutex using caller-supplied static storage.
 
OVE_NODISCARD int void ove_mutex_deinit (ove_mutex_t mtx)
 Release resources held by a mutex initialised with ove_mutex_init().
 
OVE_NODISCARD int ove_sem_init (ove_sem_t *sem, ove_sem_storage_t *storage, unsigned int initial, unsigned int max) OVE_NONNULL(1
 Initialise a counting semaphore using caller-supplied static storage.
 
OVE_NODISCARD int void ove_sem_deinit (ove_sem_t sem)
 Release resources held by a semaphore initialised with ove_sem_init().
 
OVE_NODISCARD int ove_event_init (ove_event_t *evt, ove_event_storage_t *storage) OVE_NONNULL(1
 Initialise a binary event object using caller-supplied static storage.
 
OVE_NODISCARD int void ove_event_deinit (ove_event_t evt)
 Release resources held by an event initialised with ove_event_init().
 
OVE_NODISCARD int ove_recursive_mutex_init (ove_mutex_t *mtx, ove_mutex_storage_t *storage) OVE_NONNULL(1
 Initialise a recursive mutex using caller-supplied static storage.
 
OVE_NODISCARD int OVE_NODISCARD int ove_condvar_init (ove_condvar_t *cv, ove_condvar_storage_t *storage) OVE_NONNULL(1
 Initialise a condition variable using caller-supplied static storage.
 
OVE_NODISCARD int OVE_NODISCARD int void ove_condvar_deinit (ove_condvar_t cv)
 Release resources held by a condition variable initialised with ove_condvar_init().
 
OVE_NODISCARD int ove_mutex_create (ove_mutex_t *mtx) OVE_NONNULL(1)
 Allocate and initialise a non-recursive mutex from the heap.
 
void ove_mutex_destroy (ove_mutex_t mtx)
 Destroy and free a mutex allocated with ove_mutex_create().
 
OVE_NODISCARD int ove_sem_create (ove_sem_t *sem, unsigned int initial, unsigned int max) OVE_NONNULL(1)
 Allocate and initialise a counting semaphore from the heap.
 
void ove_sem_destroy (ove_sem_t sem)
 Destroy and free a semaphore allocated with ove_sem_create().
 
OVE_NODISCARD int ove_event_create (ove_event_t *evt) OVE_NONNULL(1)
 Allocate and initialise a binary event from the heap.
 
void ove_event_destroy (ove_event_t evt)
 Destroy and free an event allocated with ove_event_create().
 
OVE_NODISCARD int ove_recursive_mutex_create (ove_mutex_t *mtx) OVE_NONNULL(1)
 Allocate and initialise a recursive mutex from the heap.
 
void ove_recursive_mutex_destroy (ove_mutex_t mtx)
 Destroy and free a recursive mutex allocated with ove_recursive_mutex_create().
 
OVE_NODISCARD int ove_condvar_create (ove_condvar_t *cv) OVE_NONNULL(1)
 Allocate and initialise a condition variable from the heap.
 
void ove_condvar_destroy (ove_condvar_t cv)
 Destroy and free a condition variable allocated with ove_condvar_create().
 
OVE_NODISCARD int ove_mutex_lock (ove_mutex_t mtx, uint64_t timeout_ns) OVE_NONNULL(1)
 Acquire a non-recursive mutex, blocking until it is available or the timeout expires.
 
static OVE_NODISCARD int ove_mutex_lock_until (ove_mutex_t mtx, uint64_t deadline_ns)
 Deadline-based variant of ove_mutex_lock.
 
void ove_mutex_unlock (ove_mutex_t mtx)
 Release a non-recursive mutex previously acquired by ove_mutex_lock().
 
OVE_NODISCARD int ove_sem_take (ove_sem_t sem, uint64_t timeout_ns) OVE_NONNULL(1)
 Decrement (take) a semaphore, blocking until a count is available or the timeout expires.
 
static OVE_NODISCARD int ove_sem_take_until (ove_sem_t sem, uint64_t deadline_ns)
 Deadline-based variant of ove_sem_take.
 
void ove_sem_give (ove_sem_t sem)
 Increment (give) a semaphore, potentially unblocking a waiting thread.
 
int ove_sem_set_notify (ove_sem_t sem, ove_notify_cb cb, void *user_data) OVE_NONNULL(1)
 Register a notify callback fired after every successful give.
 
OVE_NODISCARD int ove_event_wait (ove_event_t evt, uint64_t timeout_ns) OVE_NONNULL(1)
 Wait for a binary event to be signalled.
 
static OVE_NODISCARD int ove_event_wait_until (ove_event_t evt, uint64_t deadline_ns)
 Deadline-based variant of ove_event_wait.
 
void ove_event_signal (ove_event_t evt)
 Signal a binary event, unblocking one waiting thread.
 
void ove_event_signal_from_isr (ove_event_t evt)
 Signal a binary event from an interrupt service routine.
 
OVE_NODISCARD int ove_recursive_mutex_lock (ove_mutex_t mtx, uint64_t timeout_ns) OVE_NONNULL(1)
 Acquire a recursive mutex, blocking until it is available or the timeout expires.
 
static OVE_NODISCARD int ove_recursive_mutex_lock_until (ove_mutex_t mtx, uint64_t deadline_ns)
 Deadline-based variant of ove_recursive_mutex_lock.
 
void ove_recursive_mutex_unlock (ove_mutex_t mtx)
 Release one level of a recursive mutex lock.
 
OVE_NODISCARD int ove_condvar_wait (ove_condvar_t cv, ove_mutex_t mtx, uint64_t timeout_ns) OVE_NONNULL(1
 Atomically release a mutex and wait on a condition variable.
 
OVE_NODISCARD int static OVE_NODISCARD int ove_condvar_wait_until (ove_condvar_t cv, ove_mutex_t mtx, uint64_t deadline_ns)
 Deadline-based variant of ove_condvar_wait.
 
void ove_condvar_signal (ove_condvar_t cv)
 Wake one thread waiting on a condition variable.
 
void ove_condvar_broadcast (ove_condvar_t cv)
 Wake all threads waiting on a condition variable.
 

Detailed Description

Mutex, counting semaphore, binary event, recursive mutex, and condition variable APIs.

Note
All functions in this group require CONFIG_OVE_SYNC to be defined. When CONFIG_OVE_SYNC is not set, every function is replaced by a static inline stub that returns OVE_ERR_NOT_SUPPORTED.

Two allocation strategies are available for each primitive:

Function Documentation

◆ ove_mutex_init()

OVE_NODISCARD int ove_mutex_init ( ove_mutex_t mtx,
ove_mutex_storage_t *  storage 
)

Initialise a non-recursive mutex using caller-supplied static storage.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[out]mtxReceives the opaque mutex handle on success.
[in]storagePointer to statically allocated backend storage. Must remain valid for the lifetime of the mutex.
Returns
OVE_OK on success, or a negative error code on failure.
See also
ove_mutex_deinit, ove_mutex_create, ove_mutex_lock, ove_mutex_unlock

◆ ove_mutex_deinit()

OVE_NODISCARD int void ove_mutex_deinit ( ove_mutex_t  mtx)

Release resources held by a mutex initialised with ove_mutex_init().

Every backend MUST release any kernel-side resources associated with the mutex (e.g. destroy semaphores, free kernel handles). The static storage supplied at init time is not freed — the caller owns it. After ove_mutex_deinit() returns, the handle is invalid; calling any other mutex operation on it is undefined.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]mtxHandle returned by ove_mutex_init().
See also
ove_mutex_init

◆ ove_sem_init()

OVE_NODISCARD int ove_sem_init ( ove_sem_t sem,
ove_sem_storage_t *  storage,
unsigned int  initial,
unsigned int  max 
)

Initialise a counting semaphore using caller-supplied static storage.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[out]semReceives the opaque semaphore handle on success.
[in]storagePointer to statically allocated backend storage. Must remain valid for the lifetime of the semaphore.
[in]initialInitial count value.
[in]maxMaximum count value.
Returns
OVE_OK on success, or a negative error code on failure.
See also
ove_sem_deinit, ove_sem_create, ove_sem_take, ove_sem_give

◆ ove_sem_deinit()

OVE_NODISCARD int void ove_sem_deinit ( ove_sem_t  sem)

Release resources held by a semaphore initialised with ove_sem_init().

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]semHandle returned by ove_sem_init().
See also
ove_sem_init

◆ ove_event_init()

OVE_NODISCARD int ove_event_init ( ove_event_t evt,
ove_event_storage_t *  storage 
)

Initialise a binary event object using caller-supplied static storage.

A binary event starts in the unsignalled state. A signal is sticky: if posted while no thread is waiting, it remains pending and is consumed by the next ove_event_wait(). After a successful wait the event is auto-reset back to unsignalled.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[out]evtReceives the opaque event handle on success.
[in]storagePointer to statically allocated backend storage. Must remain valid for the lifetime of the event.
Returns
OVE_OK on success, or a negative error code on failure.
See also
ove_event_deinit, ove_event_create, ove_event_wait, ove_event_signal

◆ ove_event_deinit()

OVE_NODISCARD int void ove_event_deinit ( ove_event_t  evt)

Release resources held by an event initialised with ove_event_init().

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]evtHandle returned by ove_event_init().
See also
ove_event_init

◆ ove_recursive_mutex_init()

OVE_NODISCARD int ove_recursive_mutex_init ( ove_mutex_t mtx,
ove_mutex_storage_t *  storage 
)

Initialise a recursive mutex using caller-supplied static storage.

A recursive mutex may be locked multiple times by the same thread without deadlocking. Each successful lock must be paired with an unlock.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[out]mtxReceives the opaque mutex handle on success.
[in]storagePointer to statically allocated backend storage. Must remain valid for the lifetime of the mutex.
Returns
OVE_OK on success, or a negative error code on failure.
See also
ove_mutex_deinit, ove_recursive_mutex_create, ove_recursive_mutex_lock, ove_recursive_mutex_unlock

◆ ove_condvar_init()

OVE_NODISCARD int OVE_NODISCARD int ove_condvar_init ( ove_condvar_t cv,
ove_condvar_storage_t *  storage 
)

Initialise a condition variable using caller-supplied static storage.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[out]cvReceives the opaque condition variable handle on success.
[in]storagePointer to statically allocated backend storage. Must remain valid for the lifetime of the condvar.
Returns
OVE_OK on success, or a negative error code on failure.
See also
ove_condvar_deinit, ove_condvar_create, ove_condvar_wait, ove_condvar_signal, ove_condvar_broadcast

◆ ove_condvar_deinit()

OVE_NODISCARD int OVE_NODISCARD int void ove_condvar_deinit ( ove_condvar_t  cv)

Release resources held by a condition variable initialised with ove_condvar_init().

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]cvHandle returned by ove_condvar_init().
See also
ove_condvar_init

◆ ove_mutex_create()

OVE_NODISCARD int ove_mutex_create ( ove_mutex_t mtx)

Allocate and initialise a non-recursive mutex from the heap.

Note
Requires CONFIG_OVE_SYNC and OVE_HEAP_SYNC (i.e. CONFIG_OVE_ZERO_HEAP must not be set).
Parameters
[out]mtxReceives the opaque mutex handle on success.
Returns
OVE_OK on success, or a negative error code on failure.
See also
ove_mutex_destroy, ove_mutex_init

◆ ove_mutex_destroy()

void ove_mutex_destroy ( ove_mutex_t  mtx)

Destroy and free a mutex allocated with ove_mutex_create().

Note
Requires CONFIG_OVE_SYNC and OVE_HEAP_SYNC.
Parameters
[in]mtxHandle returned by ove_mutex_create().
See also
ove_mutex_create

◆ ove_sem_create()

OVE_NODISCARD int ove_sem_create ( ove_sem_t sem,
unsigned int  initial,
unsigned int  max 
)

Allocate and initialise a counting semaphore from the heap.

Note
Requires CONFIG_OVE_SYNC and OVE_HEAP_SYNC.
Parameters
[out]semReceives the opaque semaphore handle on success.
[in]initialInitial count value.
[in]maxMaximum count value.
Returns
OVE_OK on success, or a negative error code on failure.
See also
ove_sem_destroy, ove_sem_init

◆ ove_sem_destroy()

void ove_sem_destroy ( ove_sem_t  sem)

Destroy and free a semaphore allocated with ove_sem_create().

Note
Requires CONFIG_OVE_SYNC and OVE_HEAP_SYNC.
Parameters
[in]semHandle returned by ove_sem_create().
See also
ove_sem_create

◆ ove_event_create()

OVE_NODISCARD int ove_event_create ( ove_event_t evt)

Allocate and initialise a binary event from the heap.

Note
Requires CONFIG_OVE_SYNC and OVE_HEAP_SYNC.
Parameters
[out]evtReceives the opaque event handle on success.
Returns
OVE_OK on success, or a negative error code on failure.
See also
ove_event_destroy, ove_event_init

◆ ove_event_destroy()

void ove_event_destroy ( ove_event_t  evt)

Destroy and free an event allocated with ove_event_create().

Note
Requires CONFIG_OVE_SYNC and OVE_HEAP_SYNC.
Parameters
[in]evtHandle returned by ove_event_create().
See also
ove_event_create

◆ ove_recursive_mutex_create()

OVE_NODISCARD int ove_recursive_mutex_create ( ove_mutex_t mtx)

Allocate and initialise a recursive mutex from the heap.

Note
Requires CONFIG_OVE_SYNC and OVE_HEAP_SYNC.
Parameters
[out]mtxReceives the opaque mutex handle on success.
Returns
OVE_OK on success, or a negative error code on failure.
See also
ove_recursive_mutex_destroy, ove_recursive_mutex_init

◆ ove_recursive_mutex_destroy()

void ove_recursive_mutex_destroy ( ove_mutex_t  mtx)

Destroy and free a recursive mutex allocated with ove_recursive_mutex_create().

Note
Requires CONFIG_OVE_SYNC and OVE_HEAP_SYNC.
Parameters
[in]mtxHandle returned by ove_recursive_mutex_create().
See also
ove_recursive_mutex_create

◆ ove_condvar_create()

OVE_NODISCARD int ove_condvar_create ( ove_condvar_t cv)

Allocate and initialise a condition variable from the heap.

Note
Requires CONFIG_OVE_SYNC and OVE_HEAP_SYNC.
Parameters
[out]cvReceives the opaque condition variable handle on success.
Returns
OVE_OK on success, or a negative error code on failure.
See also
ove_condvar_destroy, ove_condvar_init

◆ ove_condvar_destroy()

void ove_condvar_destroy ( ove_condvar_t  cv)

Destroy and free a condition variable allocated with ove_condvar_create().

Note
Requires CONFIG_OVE_SYNC and OVE_HEAP_SYNC.
Parameters
[in]cvHandle returned by ove_condvar_create().
See also
ove_condvar_create

◆ ove_mutex_lock()

OVE_NODISCARD int ove_mutex_lock ( ove_mutex_t  mtx,
uint64_t  timeout_ns 
)

Acquire a non-recursive mutex, blocking until it is available or the timeout expires.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]mtxMutex handle obtained from ove_mutex_init() or ove_mutex_create().
[in]timeout_nsMaximum time to wait in nanoseconds. Pass OVE_WAIT_FOREVER to block indefinitely.
Returns
OVE_OK on success, OVE_ERR_TIMEOUT if the deadline was reached, or another negative error code on failure.
See also
ove_mutex_unlock

◆ ove_mutex_lock_until()

static OVE_NODISCARD int ove_mutex_lock_until ( ove_mutex_t  mtx,
uint64_t  deadline_ns 
)
inlinestatic

Deadline-based variant of ove_mutex_lock.

Equivalent to calling ove_mutex_lock with the time remaining until deadline_ns (a steady-clock value from ove_time_now_steady_ns). Pass OVE_WAIT_FOREVER for an indefinite block.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]mtxMutex handle.
[in]deadline_nsAbsolute deadline against ove_time_now_steady_ns, or OVE_WAIT_FOREVER.
Returns
Same set of return codes as ove_mutex_lock.

◆ ove_mutex_unlock()

void ove_mutex_unlock ( ove_mutex_t  mtx)

Release a non-recursive mutex previously acquired by ove_mutex_lock().

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]mtxMutex handle to release.
See also
ove_mutex_lock

◆ ove_sem_take()

OVE_NODISCARD int ove_sem_take ( ove_sem_t  sem,
uint64_t  timeout_ns 
)

Decrement (take) a semaphore, blocking until a count is available or the timeout expires.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]semSemaphore handle obtained from ove_sem_init() or ove_sem_create().
[in]timeout_nsMaximum time to wait in nanoseconds. Pass OVE_WAIT_FOREVER to block indefinitely.
Returns
OVE_OK on success, OVE_ERR_TIMEOUT if the deadline was reached, or another negative error code on failure.
See also
ove_sem_give

◆ ove_sem_take_until()

static OVE_NODISCARD int ove_sem_take_until ( ove_sem_t  sem,
uint64_t  deadline_ns 
)
inlinestatic

Deadline-based variant of ove_sem_take.

Equivalent to calling ove_sem_take with the time remaining until deadline_ns (a steady-clock value from ove_time_now_steady_ns). Pass OVE_WAIT_FOREVER for an indefinite block.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]semSemaphore handle.
[in]deadline_nsAbsolute deadline against ove_time_now_steady_ns, or OVE_WAIT_FOREVER.
Returns
Same set of return codes as ove_sem_take.

◆ ove_sem_give()

void ove_sem_give ( ove_sem_t  sem)

Increment (give) a semaphore, potentially unblocking a waiting thread.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]semSemaphore handle to increment.
See also
ove_sem_take

◆ ove_sem_set_notify()

int ove_sem_set_notify ( ove_sem_t  sem,
ove_notify_cb  cb,
void *  user_data 
)

Register a notify callback fired after every successful give.

The callback is invoked at the tail of ove_sem_give — once the count has been incremented. Only one slot per semaphore; a later call replaces an earlier registration. Pass cb=NULL to clear.

Designed for async runtimes (Rust binding's AsyncSemaphore) that need a wake hook. Runs in whatever context the give was issued in — implementation must be non-blocking and ISR-safe.

Parameters
[in]semSemaphore handle.
[in]cbCallback to invoke, or NULL to clear.
[in]user_dataOpaque pointer forwarded to cb.
Returns
OVE_OK on success, negative error code on failure.

◆ ove_event_wait()

OVE_NODISCARD int ove_event_wait ( ove_event_t  evt,
uint64_t  timeout_ns 
)

Wait for a binary event to be signalled.

Blocks the calling thread until ove_event_signal() or ove_event_signal_from_isr() is called on evt, or until the timeout expires. The event is automatically reset (consumed) after a successful wait.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]evtEvent handle obtained from ove_event_init() or ove_event_create().
[in]timeout_nsMaximum time to wait in nanoseconds. Pass OVE_WAIT_FOREVER to block indefinitely.
Returns
OVE_OK on success, OVE_ERR_TIMEOUT if the deadline was reached, or another negative error code on failure.
See also
ove_event_signal, ove_event_signal_from_isr

◆ ove_event_wait_until()

static OVE_NODISCARD int ove_event_wait_until ( ove_event_t  evt,
uint64_t  deadline_ns 
)
inlinestatic

Deadline-based variant of ove_event_wait.

Equivalent to calling ove_event_wait with the time remaining until deadline_ns (a steady-clock value from ove_time_now_steady_ns). Pass OVE_WAIT_FOREVER for an indefinite block.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]evtEvent handle.
[in]deadline_nsAbsolute deadline against ove_time_now_steady_ns, or OVE_WAIT_FOREVER.
Returns
Same set of return codes as ove_event_wait.

◆ ove_event_signal()

void ove_event_signal ( ove_event_t  evt)

Signal a binary event, unblocking one waiting thread.

Safe to call from any thread context. Must not be called from an ISR — use ove_event_signal_from_isr() instead.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]evtEvent handle to signal.
See also
ove_event_wait, ove_event_signal_from_isr

◆ ove_event_signal_from_isr()

void ove_event_signal_from_isr ( ove_event_t  evt)

Signal a binary event from an interrupt service routine.

ISR-safe variant of ove_event_signal(). May trigger a context switch to a higher-priority thread after the ISR exits.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]evtEvent handle to signal.
See also
ove_event_signal, ove_event_wait

◆ ove_recursive_mutex_lock()

OVE_NODISCARD int ove_recursive_mutex_lock ( ove_mutex_t  mtx,
uint64_t  timeout_ns 
)

Acquire a recursive mutex, blocking until it is available or the timeout expires.

The same thread may call this function multiple times without deadlocking. Each successful lock must be balanced by a call to ove_recursive_mutex_unlock().

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]mtxRecursive mutex handle obtained from ove_recursive_mutex_init() or ove_recursive_mutex_create().
[in]timeout_nsMaximum time to wait in nanoseconds. Pass OVE_WAIT_FOREVER to block indefinitely.
Returns
OVE_OK on success, OVE_ERR_TIMEOUT if the deadline was reached, or another negative error code on failure.
See also
ove_recursive_mutex_unlock

◆ ove_recursive_mutex_lock_until()

static OVE_NODISCARD int ove_recursive_mutex_lock_until ( ove_mutex_t  mtx,
uint64_t  deadline_ns 
)
inlinestatic

Deadline-based variant of ove_recursive_mutex_lock.

Equivalent to calling ove_recursive_mutex_lock with the time remaining until deadline_ns (a steady-clock value from ove_time_now_steady_ns). Pass OVE_WAIT_FOREVER for an indefinite block.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]mtxRecursive mutex handle.
[in]deadline_nsAbsolute deadline against ove_time_now_steady_ns, or OVE_WAIT_FOREVER.
Returns
Same set of return codes as ove_recursive_mutex_lock.

◆ ove_recursive_mutex_unlock()

void ove_recursive_mutex_unlock ( ove_mutex_t  mtx)

Release one level of a recursive mutex lock.

Decrements the recursive lock count. The mutex is fully released and made available to other threads only when the count reaches zero.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]mtxRecursive mutex handle to unlock.
See also
ove_recursive_mutex_lock

◆ ove_condvar_wait()

OVE_NODISCARD int ove_condvar_wait ( ove_condvar_t  cv,
ove_mutex_t  mtx,
uint64_t  timeout_ns 
)

Atomically release a mutex and wait on a condition variable.

The mutex mtx must be held by the calling thread before this call. It is released atomically as the thread begins waiting. When the function returns (either due to a signal or timeout), mtx is re-acquired before returning to the caller.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]cvCondition variable handle obtained from ove_condvar_init() or ove_condvar_create().
[in]mtxMutex that guards the condition. Must be locked by the calling thread.
[in]timeout_nsMaximum time to wait in nanoseconds. Pass OVE_WAIT_FOREVER to block indefinitely.
Returns
OVE_OK on success, OVE_ERR_TIMEOUT if the deadline was reached, or another negative error code on failure.
See also
ove_condvar_signal, ove_condvar_broadcast

◆ ove_condvar_wait_until()

OVE_NODISCARD int static OVE_NODISCARD int ove_condvar_wait_until ( ove_condvar_t  cv,
ove_mutex_t  mtx,
uint64_t  deadline_ns 
)
inlinestatic

Deadline-based variant of ove_condvar_wait.

Equivalent to calling ove_condvar_wait with the time remaining until deadline_ns (a steady-clock value from ove_time_now_steady_ns). Pass OVE_WAIT_FOREVER for an indefinite block.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]cvCondition variable handle.
[in]mtxMutex held by the calling thread; released atomically on wait and re-acquired before return.
[in]deadline_nsAbsolute deadline against ove_time_now_steady_ns, or OVE_WAIT_FOREVER.
Returns
Same set of return codes as ove_condvar_wait.

◆ ove_condvar_signal()

void ove_condvar_signal ( ove_condvar_t  cv)

Wake one thread waiting on a condition variable.

If no threads are waiting, the signal is lost (not stored).

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]cvCondition variable handle to signal.
See also
ove_condvar_wait, ove_condvar_broadcast

◆ ove_condvar_broadcast()

void ove_condvar_broadcast ( ove_condvar_t  cv)

Wake all threads waiting on a condition variable.

Note
Requires CONFIG_OVE_SYNC.
Parameters
[in]cvCondition variable handle to broadcast on.
See also
ove_condvar_wait, ove_condvar_signal