28 #ifndef CMSIS_PLUS_RTOS_OS_SEMAPHORE_H_ 29 #define CMSIS_PLUS_RTOS_OS_SEMAPHORE_H_ 33 #if defined(__cplusplus) 45 #pragma GCC diagnostic push 46 #pragma GCC diagnostic ignored "-Wpadded" 180 attributes_binary (
const attributes_binary&) =
default;
181 attributes_binary (attributes_binary&&) =
default;
183 operator= (
const attributes_binary&) =
default;
185 operator= (attributes_binary&&) =
default;
190 ~attributes_binary () =
default;
229 attributes_counting (
const attributes_counting&) =
default;
230 attributes_counting (attributes_counting&&) =
default;
232 operator= (
const attributes_counting&) =
default;
234 operator= (attributes_counting&&) =
default;
239 ~attributes_counting () =
default;
447 internal_init_ (
void);
450 internal_try_wait_ (
void);
471 #if !defined(OS_USE_RTOS_PORT_SEMAPHORE) 473 clock* clock_ =
nullptr;
476 #if defined(OS_USE_RTOS_PORT_SEMAPHORE) 477 friend class port::semaphore;
478 os_semaphore_port_data_t port_;
484 const count_t initial_value_ = 0;
650 #pragma GCC diagnostic pop 764 return initial_value_;
830 {
name, 1, initial_value }
bool operator==(const semaphore &rhs) const
Compare semaphores.
count_t sm_initial_value
Semaphore initial count value.
~attributes()=default
Destruct the semaphore attributes object instance.
result_t post(void)
Post (unlock) the semaphore.
constexpr attributes()
Construct a semaphore attributes object instance.
constexpr attributes_counting(count_t max_value, count_t initial_value)
Construct a counting semaphore attributes object instance.
result_t reset(void)
Reset the semaphore.
POSIX compliant semaphore.
Priority ordered list of threads.
semaphore(const attributes &attr=initializer_binary)
Construct a semaphore object instance.
Base class for attributes.
static const attributes_binary initializer_binary
Default binary semaphore initialiser.
semaphore_counting(const count_t max_value, const count_t initial_value)
Construct a binary semaphore object instance.
Binary semaphore attributes.
static constexpr count_t max_count_value
Maximum semaphore value.
const char * name(void) const
Get object name.
Base class for named system objects.
Counting semaphore attributes.
count_t sm_max_value
Semaphore max count value.
port::clock::duration_t duration_t
Type of variables holding clock durations.
result_t wait(void)
Lock the semaphore, possibly waiting.
POSIX compliant binary semaphore.
attributes & operator=(const attributes &)=default
count_t initial_value(void) const
Get the semaphore initial count value.
int16_t count_t
Type of semaphore counter storage.
~semaphore_binary()
Destruct the semaphore object instance.
constexpr attributes_binary(count_t initial_value)
Construct a binary semaphore attributes object instance.
~semaphore()
Destruct the semaphore object instance.
semaphore_binary(const count_t initial_value)
Construct a binary semaphore object instance.
result_t try_wait(void)
Try to lock the semaphore.
~semaphore_counting()
Destruct the semaphore object instance.
count_t value(void) const
Get the semaphore count value.
POSIX compliant counting semaphore.
uint32_t result_t
Type of values returned by RTOS functions.
result_t timed_wait(clock::duration_t timeout)
Timed wait to lock the semaphore.
count_t max_value(void) const
Get the semaphore maximum count value.