zpp
Zephyr C++20 Framework
zpp::lock_guard< T_Mutex > Class Template Reference

lock_guard using zpp::mutex as a lock. More...

#include <lock_guard.hpp>

Public Member Functions

 lock_guard (T_Mutex &lock) noexcept
 Try locking the mutex waiting forever. More...
 
 ~lock_guard ()
 unlock the mutex. More...
 
 lock_guard ()=delete
 
 lock_guard (lock_guard &&)=delete
 
 lock_guard (const lock_guard &)=delete
 
lock_guardoperator= (lock_guard &&)=delete
 
lock_guardoperator= (const lock_guard &)=delete
 

Detailed Description

template<typename T_Mutex>
class zpp::lock_guard< T_Mutex >

lock_guard using zpp::mutex as a lock.

Parameters
T_Mutexthe mutex type to use

Definition at line 23 of file lock_guard.hpp.

Constructor & Destructor Documentation

◆ lock_guard() [1/4]

template<typename T_Mutex >
zpp::lock_guard< T_Mutex >::lock_guard ( T_Mutex &  lock)
inlineexplicitnoexcept

Try locking the mutex waiting forever.

Parameters
lockthe mutex to lock

Definition at line 30 of file lock_guard.hpp.

31  : m_lock(lock)
32  {
33  auto res = m_lock.lock();
34  __ASSERT_NO_MSG(res != false);
35  }

◆ ~lock_guard()

template<typename T_Mutex >
zpp::lock_guard< T_Mutex >::~lock_guard ( )
inline

unlock the mutex.

Definition at line 40 of file lock_guard.hpp.

41  {
42  auto res = m_lock.unlock();
43  __ASSERT_NO_MSG(res != false);
44  }

◆ lock_guard() [2/4]

template<typename T_Mutex >
zpp::lock_guard< T_Mutex >::lock_guard ( )
delete

◆ lock_guard() [3/4]

template<typename T_Mutex >
zpp::lock_guard< T_Mutex >::lock_guard ( lock_guard< T_Mutex > &&  )
delete

◆ lock_guard() [4/4]

template<typename T_Mutex >
zpp::lock_guard< T_Mutex >::lock_guard ( const lock_guard< T_Mutex > &  )
delete

Member Function Documentation

◆ operator=() [1/2]

template<typename T_Mutex >
lock_guard& zpp::lock_guard< T_Mutex >::operator= ( const lock_guard< T_Mutex > &  )
delete

◆ operator=() [2/2]

template<typename T_Mutex >
lock_guard& zpp::lock_guard< T_Mutex >::operator= ( lock_guard< T_Mutex > &&  )
delete

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