13#ifndef CMSIS_PLUS_RTOS_OS_SEMAPHORE_H_
14#define CMSIS_PLUS_RTOS_OS_SEMAPHORE_H_
18#if defined(__cplusplus)
22#if defined(OS_USE_OS_APP_CONFIG_H)
23#include <cmsis-plus/os-app-config.h>
30#pragma GCC diagnostic push
32#pragma clang diagnostic ignored "-Wc++98-compat"
33#pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
44#pragma GCC diagnostic push
46#pragma clang diagnostic ignored "-Wpadded"
47#elif defined(__GNUC__)
48#pragma GCC diagnostic ignored "-Wpadded"
450 internal_init_ (
void);
453 internal_try_wait_ (
void);
474#if !defined(OS_USE_RTOS_PORT_SEMAPHORE)
476 clock* clock_ =
nullptr;
479#if defined(OS_USE_RTOS_PORT_SEMAPHORE)
480 friend class port::semaphore;
481 os_semaphore_port_data_t port_;
487 const count_t initial_value_ = 0;
653#pragma GCC diagnostic pop
761 return initial_value_;
936#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.