RAII wrapper around an oveRTOS binary event flag.
More...
#include <sync.hpp>
|
| | Event () |
| | Constructs and initialises the event in the unsignalled state.
|
| |
|
| ~Event () noexcept |
| | Destroys the event, releasing the underlying kernel resource.
|
| |
|
| Event (const Event &)=delete |
| |
|
Event & | operator= (const Event &)=delete |
| |
| | Event (Event &&other) noexcept |
| | Move constructor — transfers ownership of the kernel handle.
|
| |
| Event & | operator= (Event &&other) noexcept |
| | Move-assignment operator — transfers ownership of the kernel handle.
|
| |
| void | wait () |
| | Blocks the calling task until the event is signalled.
|
| |
| bool | try_wait () |
| | Non-blocking check.
|
| |
| template<class Rep , class Period > |
| Result< void > | try_wait_for (const std::chrono::duration< Rep, Period > &rel) noexcept |
| | Bounded-wait.
|
| |
| template<class Clock , class Duration > |
| Result< void > | try_wait_until (const std::chrono::time_point< Clock, Duration > &deadline) noexcept |
| | Deadline-based wait templated over the clock.
|
| |
|
void | signal () |
| | Signals the event from task context, waking any blocked waiter.
|
| |
| void | signal_from_isr () |
| | Signals the event from an ISR context, waking any blocked waiter.
|
| |
| bool | valid () const |
| | Returns true if the underlying kernel handle is non-null.
|
| |
| ove_event_t | handle () const |
| | Returns the raw oveRTOS event handle.
|
| |
RAII wrapper around an oveRTOS binary event flag.
An Event is a lightweight synchronisation primitive for signalling a single occurrence from one task (or ISR) to another. The event is in an unsignalled state after construction; signal() or signal_from_isr() wakes any task blocked in wait().
- Note
- Not copyable. Move-only when heap allocation is enabled.
◆ Event() [1/2]
Constructs and initialises the event in the unsignalled state.
Asserts at startup if initialisation fails.
◆ Event() [2/2]
| ove::Event::Event |
( |
Event && |
other | ) |
|
|
inlinenoexcept |
Move constructor — transfers ownership of the kernel handle.
- Parameters
-
| other | The source; its handle is set to null after the move. |
◆ operator=()
Move-assignment operator — transfers ownership of the kernel handle.
- Parameters
-
| other | The source; its handle is set to null after the move. |
- Returns
- Reference to this object.
◆ wait()
| void ove::Event::wait |
( |
| ) |
|
|
inline |
Blocks the calling task until the event is signalled.
Forever wait; failure means the handle is unusable. Aborts via OVE_STATIC_INIT_ASSERT (same shape as Mutex::lock and Semaphore::acquire).
◆ try_wait()
| bool ove::Event::try_wait |
( |
| ) |
|
|
inline |
Non-blocking check.
- Returns
true if the event was signalled (and the wait consumed it), false otherwise.
◆ try_wait_for()
template<class Rep , class Period >
| Result< void > ove::Event::try_wait_for |
( |
const std::chrono::duration< Rep, Period > & |
rel | ) |
|
|
inlinenoexcept |
Bounded-wait.
- Parameters
-
| [in] | rel | Relative timeout (any std::chrono::duration unit). |
- Returns
- Empty
Result<void> on signal (wait consumed it); unexpected Error::Timeout if no signal arrived by the deadline; unexpected with another Error value on backend failure.
◆ try_wait_until()
template<class Clock , class Duration >
| Result< void > ove::Event::try_wait_until |
( |
const std::chrono::time_point< Clock, Duration > & |
deadline | ) |
|
|
inlinenoexcept |
Deadline-based wait templated over the clock.
Same clock-templating rationale as Mutex::try_lock_until.
- Returns
- As try_wait_for —
Result<void> with Error::Timeout on timeout.
◆ signal_from_isr()
| void ove::Event::signal_from_isr |
( |
| ) |
|
|
inline |
Signals the event from an ISR context, waking any blocked waiter.
Must only be called from an interrupt service routine.
◆ valid()
| bool ove::Event::valid |
( |
| ) |
const |
|
inline |
Returns true if the underlying kernel handle is non-null.
- Returns
true when the event was successfully initialised.
◆ handle()
| ove_event_t ove::Event::handle |
( |
| ) |
const |
|
inline |
Returns the raw oveRTOS event handle.
- Returns
- The opaque
ove_event_t handle.
The documentation for this class was generated from the following file: