SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
stk::sync Namespace Reference

Synchronization primitives for task coordination and resource protection. More...

Classes

class  Barrier
 Cyclic barrier that blocks a fixed-size group of tasks until all of them have arrived. More...
class  ScopedCriticalSection
 RAII-style low-level synchronization primitive for atomic code execution. Used as building brick for other stk::sync classes, consider using hw::CriticalSection::ScopedLock implementation instead. More...
class  ConditionVariable
 Condition Variable primitive for signaling between tasks based on specific predicates. More...
class  Event
 Binary synchronization event (signaled / non-signaled) primitive. More...
class  EventFlagsT
 Event flags group for multi-flag synchronization between tasks, with a selectable flags word type. More...
class  FastMutex
 Non-recursive (binary) mutex primitive with ownership tracking. More...
class  MessageQueue
 Fixed-capacity, fixed-message-size FIFO queue for inter-task communication. More...
class  MessageQueueT
 Fixed-capacity, fixed-message-size FIFO queue with internal storage. More...
class  Mutex
 Recursive mutex primitive that allows the same thread to acquire the lock multiple times. More...
class  Pipe
 Thread-safe FIFO communication pipe for inter-task data passing. More...
class  PipeT
 Thread-safe, type-safe FIFO communication pipe with internal storage. More...
class  RWMutex
 Reader-Writer Lock synchronization primitive for non-recursive shared and exclusive access. More...
class  SemaphoreT
 Counting semaphore primitive for resource management and signaling, with a selectable counter type. More...
class  SpinLock
 Recursive spinlock. More...

Typedefs

typedef EventFlagsT< uint32_t > EventFlags
 Default event flags group with a 32-bit flags word (31 usable flags, bit 31 reserved).
typedef SemaphoreT< uint16_t > Semaphore
 Default counting semaphore with a 16-bit counter (max count 0xFFFF).

Variables

template<typename T>
constexpr T EventFlagsT< T >::FLAGS_MAX
template<typename T>
constexpr T EventFlagsT< T >::ERROR_MASK
template<typename T>
constexpr T EventFlagsT< T >::FLAGS_MASK
template<typename T>
constexpr uint32_t EventFlagsT< T >::OPT_WAIT_ANY
template<typename T>
constexpr uint32_t EventFlagsT< T >::OPT_WAIT_ALL
template<typename T>
constexpr uint32_t EventFlagsT< T >::OPT_NO_CLEAR
template<typename T>
constexpr T EventFlagsT< T >::ERROR_PARAMETER
template<typename T>
constexpr T EventFlagsT< T >::ERROR_TIMEOUT
template<typename T>
constexpr T EventFlagsT< T >::ERROR_ISR
template<typename T>
constexpr T EventFlagsT< T >::ERROR_CANCELED
template<typename T>
constexpr T EventFlagsT< T >::ERROR_FAIL
template<typename T>
constexpr T SemaphoreT< T >::COUNT_MAX

Detailed Description

Synchronization primitives for task coordination and resource protection.

ISR SAFETY GUIDELINES:

Special care must be taken when calling synchronization methods from within an Interrupt Service Routine (ISR).

As a general rule, methods that can cause the caller to block or sleep are STRICTLY FORBIDDEN in ISRs.

Primitive ISR Safe Methods
Event Set(), Pulse(), Reset(), TryWait()
EventFlagsT Set(), Clear(), And(), Get(), TryWait(), Wait(NO_WAIT), TryWaitEx(), WaitEx(NO_WAIT), Sync(NO_WAIT)
Semaphore Signal(), TrySignal(), TrySignal(ceiling), TryWait(), Wait(NO_WAIT), WaitEx(NO_WAIT), GetCount()
SpinLock None
Mutex None
FastMutex None
RWMutex None
ConditionVariable NotifyOne(), NotifyAll(), Wait(NO_WAIT)
Barrier None
Pipe Write(NO_WAIT), WriteBulk(NO_WAIT), TryWrite(), TryWriteBulk(), Read(NO_WAIT), ReadBulk(NO_WAIT), TryRead(), TryReadBulk()
MessageQueue Put(NO_WAIT), TryPut(), Get(NO_WAIT), TryGet(), Reset()

NOTE:

WARNING:

  • Calling a blocking method from an ISR will lead to undefined behavior, memory corruption, or a deadlock. In debug build STK_ASSERT will break code execution if ineligible for ISR method is called.

Typedef Documentation

◆ EventFlags

◆ Semaphore

typedef SemaphoreT<uint16_t> stk::sync::Semaphore

Default counting semaphore with a 16-bit counter (max count 0xFFFF).

See also
SemaphoreT
Examples
/tls/example.cpp, and secure_task/example.cpp.

Definition at line 223 of file stk_sync_semaphore.h.

Variable Documentation

◆ EventFlagsT< T >::ERROR_CANCELED

template<typename T>
T stk::sync::EventFlagsT< T >::ERROR_CANCELED
constexpr

Definition at line 431 of file stk_sync_eventflags.h.

◆ EventFlagsT< T >::ERROR_FAIL

template<typename T>
T stk::sync::EventFlagsT< T >::ERROR_FAIL
constexpr

Definition at line 432 of file stk_sync_eventflags.h.

◆ EventFlagsT< T >::ERROR_ISR

template<typename T>
T stk::sync::EventFlagsT< T >::ERROR_ISR
constexpr

Definition at line 430 of file stk_sync_eventflags.h.

◆ EventFlagsT< T >::ERROR_MASK

template<typename T>
T stk::sync::EventFlagsT< T >::ERROR_MASK
constexpr

Definition at line 423 of file stk_sync_eventflags.h.

◆ EventFlagsT< T >::ERROR_PARAMETER

template<typename T>
T stk::sync::EventFlagsT< T >::ERROR_PARAMETER
constexpr

Definition at line 428 of file stk_sync_eventflags.h.

◆ EventFlagsT< T >::ERROR_TIMEOUT

template<typename T>
T stk::sync::EventFlagsT< T >::ERROR_TIMEOUT
constexpr

Definition at line 429 of file stk_sync_eventflags.h.

◆ EventFlagsT< T >::FLAGS_MASK

template<typename T>
T stk::sync::EventFlagsT< T >::FLAGS_MASK
constexpr

Definition at line 424 of file stk_sync_eventflags.h.

◆ EventFlagsT< T >::FLAGS_MAX

template<typename T>
T stk::sync::EventFlagsT< T >::FLAGS_MAX
constexpr

Definition at line 422 of file stk_sync_eventflags.h.

◆ EventFlagsT< T >::OPT_NO_CLEAR

template<typename T>
uint32_t stk::sync::EventFlagsT< T >::OPT_NO_CLEAR
constexpr

Definition at line 427 of file stk_sync_eventflags.h.

◆ EventFlagsT< T >::OPT_WAIT_ALL

template<typename T>
uint32_t stk::sync::EventFlagsT< T >::OPT_WAIT_ALL
constexpr

Definition at line 426 of file stk_sync_eventflags.h.

◆ EventFlagsT< T >::OPT_WAIT_ANY

template<typename T>
uint32_t stk::sync::EventFlagsT< T >::OPT_WAIT_ANY
constexpr

Definition at line 425 of file stk_sync_eventflags.h.

◆ SemaphoreT< T >::COUNT_MAX

template<typename T>
T stk::sync::SemaphoreT< T >::COUNT_MAX
constexpr

Definition at line 216 of file stk_sync_semaphore.h.