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

RAII guard that the spin lock is locked on construction and unlocked it on destruction. More...

#include <stk_arch.h>

Collaboration diagram for stk::hw::SpinLock::ScopedLock:

Public Member Functions

 ScopedLock (SpinLock &sl)
 Lock a spin lock instance.
 ~ScopedLock ()
 Unlock a spin lock instance.

Private Member Functions

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

Private Attributes

SpinLockm_sl

Detailed Description

RAII guard that the spin lock is locked on construction and unlocked it on destruction.

Usage example:

{
// shared resource access protected here
} // SpinLock::Unlock() called automatically
RAII guard that the spin lock is locked on construction and unlocked it on destruction.
Definition stk_arch.h:594

Definition at line 593 of file stk_arch.h.

Constructor & Destructor Documentation

◆ ScopedLock() [1/2]

stk::hw::SpinLock::ScopedLock::ScopedLock ( SpinLock & sl)
inlineexplicit

Lock a spin lock instance.

Definition at line 598 of file stk_arch.h.

598 : m_sl(sl)
599 {
600 sl.Lock();
601 }
void Lock()
Acquire SpinLock, blocking until it is available.

References stk::hw::SpinLock::Lock(), m_sl, and stk::hw::SpinLock::SpinLock().

Referenced by operator=().

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

◆ ~ScopedLock()

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

Unlock a spin lock instance.

Definition at line 605 of file stk_arch.h.

606 {
607 m_sl.Unlock();
608 }

References m_sl.

◆ ScopedLock() [2/2]

stk::hw::SpinLock::ScopedLock::ScopedLock ( const ScopedLock & )
privatedelete

Member Function Documentation

◆ operator=()

ScopedLock & stk::hw::SpinLock::ScopedLock::operator= ( const ScopedLock & )
privatedelete

References ScopedLock().

Here is the call graph for this function:

Member Data Documentation

◆ m_sl

SpinLock& stk::hw::SpinLock::ScopedLock::m_sl
private

Definition at line 612 of file stk_arch.h.

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


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