CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
ConditionVariable Class Reference

Condition variable C++ wrapper. More...

#include <locks.hh>

Public Member Functions

int signal ()
 Wake one waiter.
int broadcast ()
 Wake all waiters.
template<TryLockable Mutex>
int wait (TimeoutArgument t, Mutex &mutex)
 Atomically release mutex, wait until the condition variable is signalled, and reacquire the mutex.
template<Lockable Mutex>
requires (!TryLockable<Mutex>)
int wait (TimeoutArgument t, Mutex &mutex)
 Atomically release mutex, wait until the condition variable is signalled, and reacquire the mutex.

Detailed Description

Condition variable C++ wrapper.

Definition at line 449 of file locks.hh.

Member Function Documentation

◆ broadcast()

int ConditionVariable::broadcast ( )
inline

Wake all waiters.

Propagates errors from condition_variable_notify.

Definition at line 468 of file locks.hh.

References condition_variable_notify().

◆ signal()

int ConditionVariable::signal ( )
inline

Wake one waiter.

Propagates errors from condition_variable_notify.

Definition at line 460 of file locks.hh.

References condition_variable_notify().

◆ wait() [1/2]

template<Lockable Mutex>
requires (!TryLockable<Mutex>)
int ConditionVariable::wait ( TimeoutArgument t,
Mutex & mutex )
inline

Atomically release mutex, wait until the condition variable is signalled, and reacquire the mutex.

This variant uses locks with no timeout and so may block for longer than the specified timeout while reacquiring the lock. It will not attempt to reacquire the lock if the timeout happens before the condition variable is signalled, so can still fail in the same ways as the normal overload.

Definition at line 502 of file locks.hh.

References condition_variable_wait().

◆ wait() [2/2]

template<TryLockable Mutex>
int ConditionVariable::wait ( TimeoutArgument t,
Mutex & mutex )
inline

Atomically release mutex, wait until the condition variable is signalled, and reacquire the mutex.

This will return 0 if the sequence completes correctly, or -ETIMEDOUT if waiting or reacquiring the lock failed due to a timeout.

Definition at line 481 of file locks.hh.

References condition_variable_wait().


The documentation for this class was generated from the following file: