oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Functions
sync.h File Reference
#include "ove/types.h"
#include "ove_config.h"
#include "ove/storage.h"
#include "ove/time.h"
Include dependency graph for sync.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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.