10#ifndef STK_SYNC_EVENT_H_
11#define STK_SYNC_EVENT_H_
69 explicit Event(
bool manual_reset =
false,
bool initial_state =
false)
159 __stk_full_memfence();
185 __stk_full_memfence();
203 __stk_full_memfence();
219 __stk_full_memfence();
231 bool success =
false;
239 __stk_full_memfence();
245 else if (timeout_ticks !=
NO_WAIT)
272 __stk_full_memfence();
297 __stk_full_memfence();
#define STK_NONCOPYABLE_CLASS(TYPE)
Disables copy construction and assignment for a class.
#define STK_ASSERT(e)
Runtime assertion. Halts execution if the expression e evaluates to false.
#define STK_VIRT_DTOR
Makes destructors virtual and compliant to strict rules if STK_STRICT_COMPLIANCY=0.
Implementation of synchronization primitive: stk::sync::ScopedCriticalSection.
Namespace of STK package.
static constexpr Timeout NO_WAIT
Timeout value: return immediately if the synchronization object is not yet signaled (non-blocking pol...
@ WAIT_RESULT_SIGNAL
The wake was caused by a signal.
int32_t Timeout
Timeout time (ticks).
static constexpr Timeout WAIT_INFINITE
Timeout value: block indefinitely until the synchronization object is signaled.
bool IsInsideISR()
Check whether the CPU is currently executing inside a hardware interrupt service routine (ISR).
Synchronization primitives for task coordination and resource protection.
virtual bool IsTimeout() const =0
Check if task woke up due to a timeout.
static IKernelService * GetInstance()
Get CPU-local instance of the kernel service.
virtual EWaitResult Wait(ISyncObject *sobj, IMutex *mutex, Timeout timeout)=0
Put calling process into a waiting state until synchronization object is signaled or timeout occurs.
void WakeAll() override
Wake all tasks currently in the wait list.
SyncObjectBase()
Constructor.
void RemoveWaitObject(IWaitObject *wobj) override
Called by kernel when a waiting task is being removed (timeout expired, wait aborted,...
IWaitObject::ListHeadType m_wait_list
Tasks blocked on this object.
void WakeOne() override
Wake the first task in the wait list (FIFO order).
RAII-style low-level synchronization primitive for atomic code execution. Used as building brick for ...
bool Set()
Set event to signaled state.
void Pulse()
Pulse event: attempt to release waiters and then reset (Win32 PulseEvent() semantics).
bool TryWait()
Poll event state without blocking.
bool Reset()
Reset event to non-signaled state.
bool Wait(Timeout timeout_ticks=WAIT_INFINITE)
Wait until event becomes signaled or the timeout expires.
bool m_signaled
current signaled state of the event
void RemoveWaitObject(IWaitObject *wobj) override
Called by kernel when a waiting task is being removed (timeout expired, wait aborted,...
Event(bool manual_reset=false, bool initial_state=false)
Constructor.
bool m_manual_reset
true = manual-reset event, false = auto-reset