The Semaphore class is used to manage and protect access to a set of shared resources. More...
#include <Semaphore.h>
Public Member Functions | |
Semaphore (int32_t count=0) | |
Create and Initialize a Semaphore object used for managing resources. More... | |
Semaphore (int32_t count, uint16_t max_count) | |
Create and Initialize a Semaphore object used for managing resources. More... | |
int32_t | wait (uint32_t millisec=osWaitForever) |
Wait until a Semaphore resource becomes available. More... | |
int32_t | wait_until (uint64_t millisec) |
Wait until a Semaphore resource becomes available. More... | |
void | acquire () |
Wait until a Semaphore resource becomes available. More... | |
bool | try_acquire () |
Try to acquire a Semaphore resource, and return immediately. More... | |
bool | try_acquire_for (uint32_t millisec) |
Wait until a Semaphore resource becomes available. More... | |
bool | try_acquire_until (uint64_t millisec) |
Wait until a Semaphore resource becomes available. More... | |
osStatus | release (void) |
Release a Semaphore resource that was obtain with Semaphore::acquire. More... | |
~Semaphore () | |
Semaphore destructor. More... | |
The Semaphore class is used to manage and protect access to a set of shared resources.
Definition at line 46 of file Semaphore.h.
Semaphore | ( | int32_t | count = 0 | ) |
Create and Initialize a Semaphore object used for managing resources.
count | number of available resources; maximum index value is (count-1). (default: 0). |
Semaphore | ( | int32_t | count, |
uint16_t | max_count | ||
) |
Create and Initialize a Semaphore object used for managing resources.
count | number of available resources |
max_count | maximum number of available resources |
void acquire | ( | ) |
Wait until a Semaphore resource becomes available.
osStatus release | ( | void | ) |
Release a Semaphore resource that was obtain with Semaphore::acquire.
bool try_acquire | ( | ) |
Try to acquire a Semaphore resource, and return immediately.
bool try_acquire_for | ( | uint32_t | millisec | ) |
Wait until a Semaphore resource becomes available.
millisec | timeout value. |
bool try_acquire_until | ( | uint64_t | millisec | ) |
Wait until a Semaphore resource becomes available.
millisec | absolute timeout time, referenced to Kernel::get_ms_count() |
int32_t wait | ( | uint32_t | millisec = osWaitForever | ) |
Wait until a Semaphore resource becomes available.
millisec | timeout value. (default: osWaitForever). |
int32_t wait_until | ( | uint64_t | millisec | ) |
Wait until a Semaphore resource becomes available.
millisec | absolute timeout time, referenced to Kernel::get_ms_count() |