#include <threads.h>
Public Member Functions | |
void | wake_one () |
void | wake_all () |
template<typename Lock> | |
void | wait (const Lock &l) |
Wait with the given guard (should be a lock type that is a friend of this condition object). | |
template<typename Lock, typename Pred> | |
void | wait (const Lock &l, Pred p) |
Wait until the given predicate returns true. | |
template<typename Lock> | |
bool | timed_wait (const Lock &l, const timespec &until) |
Wait until either the condition is signalled or until the given time. | |
template<typename Lock, typename Pred> | |
bool | timed_wait (const Lock &l, const timespec &until, const Pred &p) |
Wait either until the condition is signalled while the given predicate is true or until the given time. |
When a condition variable is destroyed, any threads that are still blocked on it are woken up.
void cwidget::threads::condition::wait | ( | const Lock & | l | ) | [inline] |
void cwidget::threads::condition::wait | ( | const Lock & | l, | |
Pred | p | |||
) | [inline] |
bool cwidget::threads::condition::timed_wait | ( | const Lock & | l, | |
const timespec & | until | |||
) | [inline] |
Wait until either the condition is signalled or until the given time.
This is a cancellation point. If the thread is cancelled while waiting on the condition, the mutex will be unlocked. This does not apply to the predicate; it is responsible for cleaning up the mutex itself if the thread is cancelled while it is running.
l | the guard of the condition | |
until | the time at which the wait should terminate |
bool cwidget::threads::condition::timed_wait | ( | const Lock & | l, | |
const timespec & | until, | |||
const Pred & | p | |||
) | [inline] |
Wait either until the condition is signalled while the given predicate is true or until the given time.
This is a cancellation point. If the thread is cancelled while waiting on the condition mutex will be unlocked. If the thread is cancelled while invoking the predicate, no guarantees are made by this routine; if the predicate invokes a cancellation point, it is responsible for pushing a cleanup handler.