FreeRTOS Addons
|
#include <semaphore.hpp>
Public Member Functions | |
virtual | ~Semaphore () |
bool | Give () |
bool | GiveFromISR (BaseType_t *pxHigherPriorityTaskWoken) |
bool | Take (TickType_t Timeout=portMAX_DELAY) |
bool | TakeFromISR (BaseType_t *pxHigherPriorityTaskWoken) |
Protected Member Functions | |
Semaphore () | |
Protected Attributes | |
SemaphoreHandle_t | handle |
Base wrapper class around FreeRTOS's implementation of semaphores.
It is not expected that an application will derive from this class.
Note that we distinguish between Semaphore, Binary Semaphores, Counting Semaphores, and Mutexes. Mutexes, while implemented as a kind of semaphore in FreeRTOS, are conceptually very different in use and behavior from semaphores. We acknowledge this difference in the class heirarchy, implementing mutextes as a completely different class heirarchy.
|
virtual |
Our destructor
|
protected |
We do not want a Semaphore ctor. This class should never be directly created, this is a base class only.
bool Semaphore::Give | ( | ) |
Release (give) a semaphore.
bool Semaphore::GiveFromISR | ( | BaseType_t * | pxHigherPriorityTaskWoken | ) |
Release (give) a semaphore from ISR context.
pxHigherPriorityTaskWoken | Did this operation result in a rescheduling event. |
bool Semaphore::Take | ( | TickType_t | Timeout = portMAX_DELAY | ) |
Aquire (take) a semaphore.
Example of blocking indefinitely: aSemaphore.Take();
Example of blocking for 100 ticks: aSemaphore.Take(100);
Timeout | How long to wait to get the Lock until giving up. |
bool Semaphore::TakeFromISR | ( | BaseType_t * | pxHigherPriorityTaskWoken | ) |
Aquire (take) a semaphore from ISR context.
pxHigherPriorityTaskWoken | Did this operation result in a rescheduling event. |
|
protected |
FreeRTOS semaphore handle.