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::hw::CriticalSection::ScopedLock Class Reference

RAII instance that enters the critical section on construction and exits it on destruction. More...

#include <stk_arch.h>

Public Member Functions

 ScopedLock ()
 Enter the critical section.
 ~ScopedLock ()
 Exit the critical section.

Private Member Functions

 STK_NONCOPYABLE_CLASS (ScopedLock)

Private Attributes

CriticalSection::Session m_ses

Detailed Description

RAII instance that enters the critical section on construction and exits it on destruction.

Note
Guarantees Exit() is always called even if an early return or exception unwinds the scope.

Usage example:

{
// shared resource access protected here
} // CriticalSection::Exit() called automatically
RAII instance that enters the critical section on construction and exits it on destruction.
Definition stk_arch.h:386

Definition at line 385 of file stk_arch.h.

Constructor & Destructor Documentation

◆ ScopedLock()

stk::hw::CriticalSection::ScopedLock::ScopedLock ( )
inlineexplicit

Enter the critical section.

Definition at line 390 of file stk_arch.h.

391 {}
static Session Enter(const Session ses=DEFAULT_SESSION)
Enter a critical section.
CriticalSection::Session m_ses
Definition stk_arch.h:402

References stk::hw::CriticalSection::CriticalSection(), stk::hw::CriticalSection::Enter(), and m_ses.

Referenced by STK_NONCOPYABLE_CLASS().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~ScopedLock()

stk::hw::CriticalSection::ScopedLock::~ScopedLock ( )
inline

Exit the critical section.

Definition at line 395 of file stk_arch.h.

396 {
398 }
static void Exit(const Session ses=DEFAULT_SESSION)
Exit a critical section.

References stk::hw::CriticalSection::Exit(), and m_ses.

Here is the call graph for this function:

Member Function Documentation

◆ STK_NONCOPYABLE_CLASS()

stk::hw::CriticalSection::ScopedLock::STK_NONCOPYABLE_CLASS ( ScopedLock )
private

References ScopedLock().

Here is the call graph for this function:

Member Data Documentation

◆ m_ses

CriticalSection::Session stk::hw::CriticalSection::ScopedLock::m_ses
private

Definition at line 402 of file stk_arch.h.

Referenced by ScopedLock(), and ~ScopedLock().


The documentation for this class was generated from the following file: