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

A futex class referencing another futex object. More...

#include <futex.hpp>

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

Public Member Functions

constexpr futex_ref (native_pointer f) noexcept
 Construct a futex using a native k_futex*. More...
 
template<typename T_Futex >
constexpr futex_ref (T_Futex &f) noexcept
 Construct a futex using another futex object. More...
 
constexpr futex_refoperator= (native_pointer f) noexcept
 copy operator More...
 
template<typename T_Futex >
constexpr futex_refoperator= (T_Futex &f) noexcept
 copy operator More...
 
constexpr auto native_handle () noexcept -> native_pointer
 get the native zephyr futex handle. More...
 
constexpr auto native_handle () const noexcept -> native_const_pointer
 get the native zephyr futex handle. More...
 
 futex_ref ()=delete
 
- Public Member Functions inherited from zpp::futex_base< futex_ref >
 futex_base (const futex_base &)=delete
 
 futex_base (futex_base &&)=delete
 
bool wait (int expected) noexcept
 Wait for the futex. More...
 
bool try_wait (int expected) noexcept
 Try wait for the futex. More...
 
bool try_wait_for (int expected, const std::chrono::duration< T_Rep, T_Period > &timeout) noexcept
 Wait for the futex. More...
 
void wake_one () noexcept
 Wakeup one waiting thread. More...
 
void wake_all () noexcept
 Wakeup all waiting threads. More...
 
auto native_handle () noexcept -> native_pointer
 get the native zephyr futex handle. More...
 
auto native_handle () const noexcept -> native_const_pointer
 get the native zephyr futex handle. More...
 
futex_baseoperator= (const futex_base &)=delete
 
futex_baseoperator= (futex_base &&)=delete
 

Additional Inherited Members

- Public Types inherited from zpp::futex_base< futex_ref >
using native_type = struct k_futex
 
using native_pointer = native_type *
 
using native_const_pointer = native_type const *
 
- Protected Member Functions inherited from zpp::futex_base< futex_ref >
constexpr futex_base () noexcept
 Default constructor. More...
 

Detailed Description

A futex class referencing another futex object.

Definition at line 170 of file futex.hpp.

Constructor & Destructor Documentation

◆ futex_ref() [1/3]

constexpr zpp::futex_ref::futex_ref ( native_pointer  f)
inlineexplicitconstexprnoexcept

Construct a futex using a native k_futex*.

Parameters
fThe k_futex to use. f must already be initialized and will not be freed.

Definition at line 178 of file futex.hpp.

179  : m_futex_ptr(f)
180  {
181  __ASSERT_NO_MSG(m_futex_ptr != nullptr);
182  }

◆ futex_ref() [2/3]

template<typename T_Futex >
constexpr zpp::futex_ref::futex_ref ( T_Futex &  f)
inlineexplicitconstexprnoexcept

Construct a futex using another futex object.

Parameters
fThe futex to use. f must already be initialized and will not be freed.

Definition at line 191 of file futex.hpp.

192  : m_futex_ptr(f.native_handle())
193  {
194  __ASSERT_NO_MSG(m_futex_ptr != nullptr);
195  }

◆ futex_ref() [3/3]

zpp::futex_ref::futex_ref ( )
delete

Member Function Documentation

◆ native_handle() [1/2]

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

get the native zephyr futex handle.

Returns
A pointer to the zephyr k_futex.

Definition at line 243 of file futex.hpp.

244  {
245  return m_futex_ptr;
246  }

◆ native_handle() [2/2]

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

get the native zephyr futex handle.

Returns
A pointer to the zephyr k_futex.

Definition at line 233 of file futex.hpp.

234  {
235  return m_futex_ptr;
236  }

Referenced by operator=().

◆ operator=() [1/2]

constexpr futex_ref& zpp::futex_ref::operator= ( native_pointer  f)
inlineconstexprnoexcept

copy operator

Parameters
fThe k_futex to use. f must already be initialized and will not be freed.
Returns
Reference to this object

Definition at line 205 of file futex.hpp.

206  {
207  m_futex_ptr = f;
208  __ASSERT_NO_MSG(m_futex_ptr != nullptr);
209  return *this;
210  }

◆ operator=() [2/2]

template<typename T_Futex >
constexpr futex_ref& zpp::futex_ref::operator= ( T_Futex &  f)
inlineconstexprnoexcept

copy operator

Parameters
fThe futex object to use. f must already be initialized and will not be freed.
Returns
Reference to this object

Definition at line 221 of file futex.hpp.

222  {
223  m_futex_ptr = f.native_handle();
224  __ASSERT_NO_MSG(m_futex_ptr != nullptr);
225  return *this;
226  }

References native_handle().


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