SuperTinyKernel™ RTOS 1.06.0
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
stk::IMutex::ScopedLock Class Reference

Locks bound mutex within a scope of execution. Ensures the mutex is always unlocked when leaving the scope, even when exceptions are thrown. More...

#include <stk_common.h>

Collaboration diagram for stk::IMutex::ScopedLock:

Public Member Functions

 ScopedLock (IMutex &mutex)
 ~ScopedLock ()

Private Member Functions

 ScopedLock (const ScopedLock &)=delete
ScopedLockoperator= (const ScopedLock &)=delete

Private Attributes

IMutexm_mutex

Detailed Description

Locks bound mutex within a scope of execution. Ensures the mutex is always unlocked when leaving the scope, even when exceptions are thrown.

Note
RAII

Definition at line 446 of file stk_common.h.

Constructor & Destructor Documentation

◆ ScopedLock() [1/2]

stk::IMutex::ScopedLock::ScopedLock ( IMutex & mutex)
inlineexplicit

Definition at line 449 of file stk_common.h.

449: m_mutex(mutex) { m_mutex.Lock(); }

References m_mutex.

Referenced by operator=().

Here is the caller graph for this function:

◆ ~ScopedLock()

stk::IMutex::ScopedLock::~ScopedLock ( )
inline

Definition at line 450 of file stk_common.h.

450{ m_mutex.Unlock(); }

References m_mutex.

◆ ScopedLock() [2/2]

stk::IMutex::ScopedLock::ScopedLock ( const ScopedLock & )
privatedelete

Member Function Documentation

◆ operator=()

ScopedLock & stk::IMutex::ScopedLock::operator= ( const ScopedLock & )
privatedelete

References ScopedLock().

Here is the call graph for this function:

Member Data Documentation

◆ m_mutex

IMutex& stk::IMutex::ScopedLock::m_mutex
private

Definition at line 455 of file stk_common.h.

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


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