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

RAII wrapper for attempting shared read access with a timeout. More...

#include <stk_sync_rwmutex.h>

Collaboration diagram for stk::sync::RWMutex::ScopedTimedReadMutex:

Public Member Functions

 ScopedTimedReadMutex (RWMutex &rw, Timeout timeout_ticks=WAIT_INFINITE)
 Constructs the guard and attempts to acquire the read lock.
 ~ScopedTimedReadMutex ()
bool IsLocked () const

Private Member Functions

 ScopedTimedReadMutex (const ScopedTimedReadMutex &)=delete
ScopedTimedReadMutexoperator= (const ScopedTimedReadMutex &)=delete

Private Attributes

RWMutexm_rw
bool m_locked

Detailed Description

RAII wrapper for attempting shared read access with a timeout.

Definition at line 110 of file stk_sync_rwmutex.h.

Constructor & Destructor Documentation

◆ ScopedTimedReadMutex() [1/2]

stk::sync::RWMutex::ScopedTimedReadMutex::ScopedTimedReadMutex ( RWMutex & rw,
Timeout timeout_ticks = WAIT_INFINITE )
inlineexplicit

Constructs the guard and attempts to acquire the read lock.

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

Definition at line 117 of file stk_sync_rwmutex.h.

118 : m_rw(rw), m_locked(rw.TimedReadLock(timeout_ticks))
119 {}

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

Referenced by operator=().

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

◆ ~ScopedTimedReadMutex()

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

Definition at line 121 of file stk_sync_rwmutex.h.

121{ if (m_locked) { m_rw.ReadUnlock(); } }

References m_locked, and m_rw.

◆ ScopedTimedReadMutex() [2/2]

stk::sync::RWMutex::ScopedTimedReadMutex::ScopedTimedReadMutex ( const ScopedTimedReadMutex & )
privatedelete

Member Function Documentation

◆ IsLocked()

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

Definition at line 123 of file stk_sync_rwmutex.h.

123{ return m_locked; }

References m_locked.

◆ operator=()

ScopedTimedReadMutex & stk::sync::RWMutex::ScopedTimedReadMutex::operator= ( const ScopedTimedReadMutex & )
privatedelete

References ScopedTimedReadMutex().

Here is the call graph for this function:

Member Data Documentation

◆ m_locked

bool stk::sync::RWMutex::ScopedTimedReadMutex::m_locked
private

Definition at line 129 of file stk_sync_rwmutex.h.

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

◆ m_rw

RWMutex& stk::sync::RWMutex::ScopedTimedReadMutex::m_rw
private

Definition at line 128 of file stk_sync_rwmutex.h.

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


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