#include <Semaphore.hpp>
Public Member Functions | |
Semaphore (unsigned int initial) | |
void | reset (unsigned int initial) |
bool | has_waiter () |
void | post () |
Increment (and signal any waiters). | |
void | wait () |
Wait until count is > 0, then decrement. | |
bool | try_wait () |
Non-blocking version of wait(). |
void Raul::Semaphore::post | ( | ) | [inline] |
void Raul::Semaphore::wait | ( | ) | [inline] |
Wait until count is > 0, then decrement.
Note that sem_wait always returns 0 in practice. It returns nonzero when run in GDB, so the while is necessary to allow debugging.
Obviously not realtime safe.
Referenced by Raul::Command::operator()().
bool Raul::Semaphore::try_wait | ( | ) | [inline] |
Non-blocking version of wait().