Counting semaphore. More...
#include <Semaphore.hpp>
Public Member Functions | |
Semaphore (unsigned int initial) | |
void | reset (unsigned int initial) |
Destroy and reset the semaphore to an initial value. | |
void | post () |
Increment (and signal any waiters). | |
void | wait () |
Wait until count is > 0, then decrement. | |
bool | try_wait () |
Non-blocking version of wait(). |
Counting semaphore.
void Raul::Semaphore::reset | ( | unsigned int | initial | ) | [inline] |
Destroy and reset the semaphore to an initial value.
This must not be called while there are any waiters.
void Raul::Semaphore::post | ( | ) | [inline] |
Increment (and signal any waiters).
Realtime safe.
void Raul::Semaphore::wait | ( | ) | [inline] |
Wait until count is > 0, then decrement.
Obviously not realtime safe.
bool Raul::Semaphore::try_wait | ( | ) | [inline] |
Non-blocking version of wait().
Realtime safe?