zpp
Zephyr C++20 Framework
zpp::mutex Class Reference

A recursive mutex class. More...

#include <mutex.hpp>

Inheritance diagram for zpp::mutex:
[legend]
Collaboration diagram for zpp::mutex:
[legend]

Public Member Functions

 mutex () noexcept
 Default contructor. More...
 
constexpr auto native_handle () noexcept -> native_pointer
 get the native zephyr mutex handle. More...
 
constexpr auto native_handle () const noexcept -> native_const_pointer
 get the native zephyr mutex handle. More...
 
 mutex (const mutex &)=delete
 
 mutex (mutex &&)=delete
 
mutexoperator= (const mutex &)=delete
 
mutexoperator= (mutex &&)=delete
 
- Public Member Functions inherited from zpp::mutex_base< mutex >
 mutex_base (const mutex_base &)=delete
 
 mutex_base (mutex_base &&)=delete
 
auto lock () noexcept
 Lock the mutex. Wait forever until it is locked. More...
 
auto try_lock () noexcept
 Try locking the mutex without waiting. More...
 
auto try_lock_for (const std::chrono::duration< T_Rep, T_Period > &timeout) noexcept
 Try locking the mutex with a timeout. More...
 
auto unlock () noexcept
 Unlock the mutex. More...
 
auto native_handle () noexcept -> native_pointer
 get the native zephyr mutex handle. More...
 
auto native_handle () const noexcept -> native_const_pointer
 get the native zephyr mutex handle. More...
 
mutex_baseoperator= (const mutex_base &)=delete
 
mutex_baseoperator= (mutex_base &&)=delete
 

Additional Inherited Members

- Public Types inherited from zpp::mutex_base< mutex >
using native_type = struct k_mutex
 
using native_pointer = native_type *
 
using native_const_pointer = native_type const *
 
- Protected Member Functions inherited from zpp::mutex_base< mutex >
constexpr mutex_base () noexcept
 Protected default constructor so only derived objects can be created. More...
 

Detailed Description

A recursive mutex class.

Definition at line 150 of file mutex.hpp.

Constructor & Destructor Documentation

◆ mutex() [1/3]

zpp::mutex::mutex ( )
inlinenoexcept

Default contructor.

Definition at line 155 of file mutex.hpp.

156  {
157  k_mutex_init(&m_mutex);
158  }

◆ mutex() [2/3]

zpp::mutex::mutex ( const mutex )
delete

◆ mutex() [3/3]

zpp::mutex::mutex ( mutex &&  )
delete

Member Function Documentation

◆ native_handle() [1/2]

constexpr auto zpp::mutex::native_handle ( ) const -> native_const_pointer
inlineconstexprnoexcept

get the native zephyr mutex handle.

Returns
A pointer to the zephyr k_mutex.

Definition at line 175 of file mutex.hpp.

176  {
177  return &m_mutex;
178  }

◆ native_handle() [2/2]

constexpr auto zpp::mutex::native_handle ( ) -> native_pointer
inlineconstexprnoexcept

get the native zephyr mutex handle.

Returns
A pointer to the zephyr k_mutex.

Definition at line 165 of file mutex.hpp.

166  {
167  return &m_mutex;
168  }

◆ operator=() [1/2]

mutex& zpp::mutex::operator= ( const mutex )
delete

◆ operator=() [2/2]

mutex& zpp::mutex::operator= ( mutex &&  )
delete

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