![]() |
SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Nestable, SMP-safe critical section that combines local interrupt masking with a global cross-core spinlock. More...
#include <stk_arch.h>
Classes | |
| class | ScopedLock |
| RAII instance that enters the critical section on construction and exits it on destruction. More... | |
Public Types | |
| enum | ESessionFlags : uint8_t { SESSION_FLAG_NONE = 0U , SESSION_FLAG_NPRIV = (1U << 0) } |
| Collection of session flags. More... | |
| typedef uint8_t | Session |
| Opaque session token returned by Enter() and consumed by Exit(). | |
Static Public Member Functions | |
| static Session | Enter (const Session ses=DEFAULT_SESSION) |
| Enter a critical section. | |
| static void | Exit (const Session ses=DEFAULT_SESSION) |
| Exit a critical section. | |
Static Public Attributes | |
| static constexpr Session | DEFAULT_SESSION = SESSION_FLAG_NONE |
| Default session value passed to Enter()/Exit() when the caller does not need to force a specific handling path. | |
Private Member Functions | |
| CriticalSection (const CriticalSection &)=delete | |
| CriticalSection & | operator= (const CriticalSection &)=delete |
| CriticalSection () | |
| Protected constructor (instantiation is prohibited). | |
Nestable, SMP-safe critical section that combines local interrupt masking with a global cross-core spinlock.
s_StkCortexmCsuLock on the ARM Cortex-M back-end) is then acquired to block any other core from entering the same critical section concurrently. On Enter() the spinlock is only acquired at nesting depth 0 so that nested Enter() calls from the same core do not deadlock. On Exit(), the spinlock is released and interrupts are restored only when the outermost Exit() brings the nesting counter back to zero. Definition at line 455 of file stk_arch.h.
| typedef uint8_t stk::hw::CriticalSection::Session |
| enum stk::hw::CriticalSection::ESessionFlags : uint8_t |
Collection of session flags.
| Enumerator | |
|---|---|
| SESSION_FLAG_NONE | None. |
| SESSION_FLAG_NPRIV | Calling context is non-Privileged. |
Definition at line 461 of file stk_arch.h.
|
privatedelete |
References CriticalSection().
Referenced by CriticalSection(), and stk::hw::CriticalSection::ScopedLock::ScopedLock().
|
inlineexplicitprivate |
Protected constructor (instantiation is prohibited).
Definition at line 544 of file stk_arch.h.
|
static |
Enter a critical section.
| [in] | ses | DEFAULT_SESSION to auto-detect the calling context's privilege level, or an explicit Session to force a specific handling path. |
References DEFAULT_SESSION.
Referenced by stk::sync::ScopedCriticalSection::Lock(), osKernelLock(), osKernelRestoreLock(), stk::hw::CriticalSection::ScopedLock::ScopedLock(), stk_critical_section_enter(), stk_critical_section_enter_ex(), vPortEnterCritical(), and vTaskSuspendAll().
|
static |
Exit a critical section.
References DEFAULT_SESSION.
Referenced by osKernelRestoreLock(), osKernelUnlock(), stk_critical_section_exit(), stk_critical_section_exit_ex(), stk::sync::ScopedCriticalSection::Unlock(), vPortExitCritical(), xTaskResumeAll(), and stk::hw::CriticalSection::ScopedLock::~ScopedLock().
|
privatedelete |
|
staticconstexpr |
Default session value passed to Enter()/Exit() when the caller does not need to force a specific handling path.
Definition at line 478 of file stk_arch.h.
Referenced by Enter(), Exit(), stk_critical_section_enter(), and stk_critical_section_exit().