zpp
Zephyr C++20 Framework
|
A counting semaphore class. More...
#include <sem.hpp>
Public Member Functions | |
sem (counter_type initial_count, counter_type count_limit) noexcept | |
Constructor initializing initial count and count limit. More... | |
sem (counter_type initial_count) noexcept | |
Constructor initializing initial count. More... | |
sem () noexcept | |
Default onstructor. 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... | |
sem (const sem &)=delete | |
sem (sem &&)=delete | |
sem & | operator= (const sem &)=delete |
sem & | operator= (sem &&)=delete |
Public Member Functions inherited from zpp::sem_base< sem > | |
sem_base (const sem_base &)=delete | |
sem_base (sem_base &&)=delete | |
bool | take () noexcept |
Take the semaphore waiting forever. More... | |
bool | try_take () noexcept |
Try to take the semaphore without waiting. More... | |
bool | try_take_for (const std::chrono::duration< T_Rep, T_Period > &timeout_duration) noexcept |
Try to take the semaphore waiting a certain timeout. More... | |
void | give () noexcept |
Give the semaphore. More... | |
void | reset () noexcept |
Reset the semaphore counter to zero. More... | |
counter_type | count () noexcept |
Get current semaphore count. More... | |
void | operator++ (int) noexcept |
Give the semaphore. More... | |
void | operator-- (int) noexcept |
Take the semaphore waiting forever. More... | |
void | operator+= (int n) noexcept |
Give the semaphore n times. More... | |
void | operator-= (int n) noexcept |
Take the semaphore n times, waiting forever. More... | |
auto | native_handle () noexcept -> native_pointer |
get the native zephyr sem handle. More... | |
auto | native_handle () const noexcept -> native_const_pointer |
get the native zephyr sem handle. More... | |
sem_base & | operator= (const sem_base &)=delete |
sem_base & | operator= (sem_base &&)=delete |
Additional Inherited Members | |
Public Types inherited from zpp::sem_base< sem > | |
using | native_type = struct k_sem |
using | native_pointer = native_type * |
using | native_const_pointer = native_type const * |
using | counter_type = uint32_t |
Type used as counter. More... | |
Static Public Attributes inherited from zpp::sem_base< sem > | |
constexpr static counter_type | max_count |
Maximum value of the counter. More... | |
Protected Member Functions inherited from zpp::sem_base< sem > | |
constexpr | sem_base () noexcept |
Default constructor, only allowed derived objects. More... | |
|
inlinenoexcept |
|
inlineexplicitnoexcept |
Constructor initializing initial count.
Contructor initializing initial count to initial_count and the maxium count limit to max_count.
initial_count | The initial count value for the semaphore |
Definition at line 217 of file sem.hpp.
|
inlinenoexcept |
|
delete |
|
delete |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |