|
SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
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...
#include <stk_sync_cs.h>
Public Member Functions | |
| ScopedCriticalSection () | |
| Enters critical section. | |
| STK_VIRT_DTOR | ~ScopedCriticalSection () |
| Exits critical section. | |
Protected Member Functions | |
| STK_NONCOPYABLE_CLASS (ScopedCriticalSection) | |
| void | Lock () override |
| Lock the mutex. | |
| bool | TryLock () override |
| Try locking the mutex in a single non-blocking attempt. | |
| void | Unlock () override |
| Unlock the mutex. | |
Protected Attributes | |
| hw::CriticalSection::Session | m_ses |
| current session of hw::CriticalSection | |
Friends | |
| class | Event |
| template<typename T> | |
| class | EventFlagsT |
| class | Mutex |
| class | FastMutex |
| class | RWMutex |
| template<typename T> | |
| class | SemaphoreT |
| class | Pipe |
| template<typename T, size_t N> | |
| class | PipeT |
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.
Disables interrupts on caller's CPU core and guards from access by another CPU core in case of multi-core system. Enters a critical section upon construction and exits automatically when the object goes out of scope.
Definition at line 53 of file stk_sync_cs.h.
|
inlineexplicit |
Enters critical section.
Definition at line 71 of file stk_sync_cs.h.
Referenced by STK_NONCOPYABLE_CLASS().
|
inline |
Exits critical section.
Definition at line 79 of file stk_sync_cs.h.
References STK_VIRT_DTOR, and Unlock().
|
inlineoverrideprotectedvirtual |
Lock the mutex.
Implements stk::IMutex.
Definition at line 87 of file stk_sync_cs.h.
References stk::hw::CriticalSection::Enter(), and m_ses.
Referenced by ScopedCriticalSection(), and TryLock().
|
protected |
|
inlineoverrideprotectedvirtual |
Try locking the mutex in a single non-blocking attempt.
true if the lock was acquired; false if it was already held by another thread/core. Implements stk::IMutex.
Definition at line 92 of file stk_sync_cs.h.
References Lock().
|
inlineoverrideprotectedvirtual |
Unlock the mutex.
Implements stk::IMutex.
Definition at line 98 of file stk_sync_cs.h.
References stk::hw::CriticalSection::Exit(), and m_ses.
Referenced by ~ScopedCriticalSection().
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
current session of hw::CriticalSection
Definition at line 103 of file stk_sync_cs.h.
Referenced by Lock(), ScopedCriticalSection(), and Unlock().