µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches

C++ API semaphores definitions. More...

Classes

class  os::rtos::semaphore::attributes
 Semaphore attributes. More...
 
class  os::rtos::semaphore::attributes_binary
 Binary semaphore attributes. More...
 
class  os::rtos::semaphore::attributes_counting
 Counting semaphore attributes. More...
 
class  os::rtos::semaphore
 POSIX compliant semaphore. More...
 
class  os::rtos::semaphore_binary
 POSIX compliant binary semaphore. More...
 
class  os::rtos::semaphore_counting
 POSIX compliant counting semaphore. More...
 

Typedefs

using os::rtos::semaphore::count_t = int16_t
 Type of semaphore counter storage.
 

Variables

static const attributes_binary os::rtos::semaphore::initializer_binary { 0 }
 Default binary semaphore initialiser.
 
static constexpr count_t os::rtos::semaphore::max_count_value = 0x7FFF
 Maximum semaphore value.
 

Detailed Description

C++ API semaphores definitions.

Examples
int
os_main (int argc, char* argv[])
{
{
// Binary semaphore.
semaphore_binary sp1;
sp1.post ();
}
{
// Named binary semaphore.
semaphore_binary sp2
{ "sp2" };
sp2.post ();
sp2.wait ();
sp2.post ();
sp2.try_wait ();
sp2.post ();
sp2.timed_wait (1);
sp2.post ();
sp2.timed_wait (0xFFFFFFFF);
}
{
// Named counting semaphore.
semaphore_counting sp3
{ "sp3", 7 };
sp3.post ();
}
{
// Named counting semaphore with custom initial value.
semaphore_counting sp4
{ "sp4", 7, 7 };
sp4.post ();
}
}
int os_main(int argc, char *argv[])
Application entry point, running on the main thread context.

Typedef Documentation

◆ count_t

Type of semaphore counter storage.

A numeric value enough to hold the semaphore counter, usually a 16-bits signed value.

Definition at line 67 of file os-semaphore.h.

Variable Documentation

◆ initializer_binary

const semaphore::attributes_binary os::rtos::semaphore::initializer_binary { 0 }
static

Default binary semaphore initialiser.

This variable is used by the default constructor.

Definition at line 205 of file os-semaphore.h.

◆ max_count_value

constexpr count_t os::rtos::semaphore::max_count_value = 0x7FFF
staticconstexpr

Maximum semaphore value.

Used to validate the semaphore initial count and max count.

Definition at line 75 of file os-semaphore.h.