Generic unnamed semaphore class. More...
#include <Semaphore.h>
Public Member Functions | |
void | post () |
Post the semaphore. More... | |
bool | sleep_for (std::chrono::milliseconds timeout) |
Wait until semaphore value is greater than zero, or until timeout interval is passed. More... | |
bool | sleep_until (DateTime timeout) |
Wait until semaphore value is greater than zero, or until timeoutAt occurs. More... | |
Generic unnamed semaphore class.
void sptk::Semaphore::post | ( | ) |
Post the semaphore.
The semaphore value is increased by one.
Referenced by sptk::SynchronizedQueue< T >::push(), sptk::SynchronizedList< T >::push_back(), sptk::SynchronizedList< T >::push_front(), sptk::SynchronizedList< T >::wakeup(), and sptk::SynchronizedQueue< T >::wakeup().
bool sptk::Semaphore::sleep_for | ( | std::chrono::milliseconds | timeout | ) |
Wait until semaphore value is greater than zero, or until timeout interval is passed.
If semaphore value is greater than zero, decreases semaphore value by one and returns true.
timeout | Wait timeout |
Referenced by sptk::SynchronizedQueue< T >::pop(), sptk::SynchronizedList< T >::pop_back(), and sptk::SynchronizedList< T >::pop_front().
bool sptk::Semaphore::sleep_until | ( | DateTime | timeout | ) |
Wait until semaphore value is greater than zero, or until timeoutAt occurs.
If semaphore value is greater than zero, decreases semaphore value by one and returns true.
timeout | Timeout moment |