28#ifndef CMSIS_PLUS_RTOS_OS_SEMAPHORE_H_
29#define CMSIS_PLUS_RTOS_OS_SEMAPHORE_H_
33#if defined(__cplusplus)
41#pragma GCC diagnostic push
44#pragma clang diagnostic ignored "-Wc++98-compat"
45#pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
56#pragma GCC diagnostic push
57#pragma GCC diagnostic ignored "-Wpadded"
458 internal_init_ (
void);
461 internal_try_wait_ (
void);
482#if !defined(OS_USE_RTOS_PORT_SEMAPHORE)
484 clock* clock_ =
nullptr;
487#if defined(OS_USE_RTOS_PORT_SEMAPHORE)
488 friend class port::semaphore;
489 os_semaphore_port_data_t port_;
495 const count_t initial_value_ = 0;
661#pragma GCC diagnostic pop
774 return initial_value_;
955#pragma GCC diagnostic pop
Base class for attributes.
Base class for named system objects.
const char * name(void) const
Get object name.
Priority ordered list of threads.
Binary semaphore attributes.
constexpr attributes_binary(count_t initial_value)
Construct a binary semaphore attributes object instance.
~attributes_binary()=default
Destruct the semaphore attributes object instance.
attributes_binary & operator=(const attributes_binary &)=default
attributes_binary(attributes_binary &&)=default
attributes_binary(const attributes_binary &)=default
Counting semaphore attributes.
attributes_counting & operator=(const attributes_counting &)=default
constexpr attributes_counting(count_t max_value, count_t initial_value)
Construct a counting semaphore attributes object instance.
attributes_counting(attributes_counting &&)=default
attributes_counting(const attributes_counting &)=default
~attributes_counting()=default
Destruct the semaphore attributes object instance.
count_t sm_max_value
Semaphore max count value.
~attributes()=default
Destruct the semaphore attributes object instance.
attributes(const attributes &)=default
constexpr attributes()
Construct a semaphore attributes object instance.
count_t sm_initial_value
Semaphore initial count value.
attributes & operator=(const attributes &)=default
attributes(attributes &&)=default
POSIX compliant binary semaphore.
~semaphore_binary()
Destruct the semaphore object instance.
bool operator==(const semaphore_binary &rhs) const
Compare semaphores.
semaphore_binary(const count_t initial_value)
Construct a binary semaphore object instance.
POSIX compliant counting semaphore.
~semaphore_counting()
Destruct the semaphore object instance.
bool operator==(const semaphore_counting &rhs) const
Compare semaphores.
semaphore_counting(const count_t max_value, const count_t initial_value)
Construct a binary semaphore object instance.
POSIX compliant semaphore.
result_t timed_wait(clock::duration_t timeout)
Timed wait to lock the semaphore.
result_t wait(void)
Lock the semaphore, possibly waiting.
result_t reset(void)
Reset the semaphore.
result_t post(void)
Post (unlock) the semaphore.
result_t try_wait(void)
Try to lock the semaphore.
~semaphore()
Destruct the semaphore object instance.
semaphore(const attributes &attr=initializer_binary)
Construct a semaphore object instance.
count_t max_value(void) const
Get the semaphore maximum count value.
count_t initial_value(void) const
Get the semaphore initial count value.
count_t value(void) const
Get the semaphore count value.
bool operator==(const semaphore &rhs) const
Compare semaphores.
port::clock::duration_t duration_t
Type of variables holding clock durations.
static constexpr count_t max_count_value
Maximum semaphore value.
static const attributes_binary initializer_binary
Default binary semaphore initialiser.
int16_t count_t
Type of semaphore counter storage.
uint32_t result_t
Type of values returned by RTOS functions.