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

RAII wrapper for attempting exclusive write access with a timeout. More...

#include <stk_sync_rwmutex.h>

Collaboration diagram for stk::sync::RWMutex::ScopedTimedLock:

Public Member Functions

 ScopedTimedLock (RWMutex &rw, Timeout timeout=WAIT_INFINITE)
 Constructs the guard and attempts to acquire the write lock.
 ~ScopedTimedLock ()
bool IsLocked () const

Private Member Functions

 STK_NONCOPYABLE_CLASS (ScopedTimedLock)

Private Attributes

RWMutexm_rw
bool m_locked

Detailed Description

RAII wrapper for attempting exclusive write access with a timeout.

Definition at line 87 of file stk_sync_rwmutex.h.

Constructor & Destructor Documentation

◆ ScopedTimedLock()

stk::sync::RWMutex::ScopedTimedLock::ScopedTimedLock ( RWMutex & rw,
Timeout timeout = WAIT_INFINITE )
inlineexplicit

Constructs the guard and attempts to acquire the write lock.

Parameters
[in]rwReference to the RWMutex.
[in]timeoutMaximum time to wait (ticks). Use NO_WAIT for non-blocking (TryLock).

Definition at line 94 of file stk_sync_rwmutex.h.

References m_locked, m_rw, stk::sync::RWMutex::RWMutex(), stk::sync::RWMutex::TimedLock(), and stk::WAIT_INFINITE.

Referenced by STK_NONCOPYABLE_CLASS().

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

◆ ~ScopedTimedLock()

stk::sync::RWMutex::ScopedTimedLock::~ScopedTimedLock ( )
inline

Definition at line 98 of file stk_sync_rwmutex.h.

98{ if (m_locked) { m_rw.Unlock(); } }

References m_locked, and m_rw.

Member Function Documentation

◆ IsLocked()

bool stk::sync::RWMutex::ScopedTimedLock::IsLocked ( ) const
inline

Definition at line 100 of file stk_sync_rwmutex.h.

100{ return m_locked; }

References m_locked.

◆ STK_NONCOPYABLE_CLASS()

stk::sync::RWMutex::ScopedTimedLock::STK_NONCOPYABLE_CLASS ( ScopedTimedLock )
private

References ScopedTimedLock().

Here is the call graph for this function:

Member Data Documentation

◆ m_locked

bool stk::sync::RWMutex::ScopedTimedLock::m_locked
private

Definition at line 106 of file stk_sync_rwmutex.h.

Referenced by IsLocked(), ScopedTimedLock(), and ~ScopedTimedLock().

◆ m_rw

RWMutex& stk::sync::RWMutex::ScopedTimedLock::m_rw
private

Definition at line 105 of file stk_sync_rwmutex.h.

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


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