10#ifndef STK_SYNC_BARRIER_H_
11#define STK_SYNC_BARRIER_H_
101 bool is_last =
false;
#define STK_UNUSED(X)
Explicitly marks a variable as unused to suppress compiler warnings.
#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::ConditionVariable.
Implementation of synchronization primitive: stk::sync::Mutex.
Namespace of STK package.
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.
uint32_t m_count
number of tasks still to arrive in the current generation
Barrier(uint32_t count)
Constructor.
uint32_t GetThreshold() const
Get the number of tasks required to trip the barrier.
ConditionVariable m_cond
signals waiting tasks when the current generation completes
uint32_t m_generation
generation counter, incremented every time the barrier trips
bool Wait()
Block the calling task until count tasks have called Wait().
const uint32_t m_threshold
number of tasks required to trip the barrier
Mutex m_mutex
protects m_count / m_generation and serializes calls to m_cond
Condition Variable primitive for signaling between tasks based on specific predicates.
Recursive mutex primitive that allows the same thread to acquire the lock multiple times.