Zephyr C++ Toolkit
Loading...
Searching...
No Matches
zct::MutexLockGuard Class Reference

#include <Mutex.hpp>

Collaboration diagram for zct::MutexLockGuard:

Public Member Functions

 ~MutexLockGuard ()
 
 MutexLockGuard (const MutexLockGuard &)=delete
 
MutexLockGuardoperator= (const MutexLockGuard &)=delete
 
 MutexLockGuard (MutexLockGuard &&)
 
MutexLockGuardoperator= (MutexLockGuard &&)=delete
 
bool didGetLock () const
 Check if the mutex was successfully locked with this lock guard.
 

Protected Member Functions

 MutexLockGuard (Mutex &mutex, k_timeout_t timeout, int &mutexRc)
 Constructor is hidden since we only want to allow the Mutex class to construct MutexLockGuard objects.
 

Protected Attributes

Mutexm_mutex
 
bool m_didGetLock = false
 

Friends

class Mutex
 

Detailed Description

A RAII class that locks the mutex when constructed and unlocks it when destroyed.

Constructor & Destructor Documentation

◆ ~MutexLockGuard()

zct::MutexLockGuard::~MutexLockGuard ( )

◆ MutexLockGuard() [1/3]

zct::MutexLockGuard::MutexLockGuard ( const MutexLockGuard )
delete

◆ MutexLockGuard() [2/3]

zct::MutexLockGuard::MutexLockGuard ( MutexLockGuard &&  )

◆ MutexLockGuard() [3/3]

zct::MutexLockGuard::MutexLockGuard ( Mutex mutex,
k_timeout_t  timeout,
int &  mutexRc 
)
protected

Constructor is hidden since we only want to allow the Mutex class to construct MutexLockGuard objects.

Member Function Documentation

◆ didGetLock()

bool zct::MutexLockGuard::didGetLock ( ) const

Check if the mutex was successfully locked with this lock guard.

Returns
True if the mutex was successfully locked with this lock guard, false otherwise.

◆ operator=() [1/2]

MutexLockGuard & zct::MutexLockGuard::operator= ( const MutexLockGuard )
delete

◆ operator=() [2/2]

MutexLockGuard & zct::MutexLockGuard::operator= ( MutexLockGuard &&  )
delete

Friends And Related Symbol Documentation

◆ Mutex

friend class Mutex
friend

Member Data Documentation

◆ m_didGetLock

bool zct::MutexLockGuard::m_didGetLock = false
protected

◆ m_mutex

Mutex& zct::MutexLockGuard::m_mutex
protected

The mutex this guard is locking/unlocking.


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