glibmm
2.45.2
|
An opaque data structure to represent a condition. More...
#include <glibmm/threads.h>
Public Member Functions | |
Cond () | |
~Cond () | |
void | signal () |
If threads are waiting for this Cond, exactly one of them is woken up. More... | |
void | broadcast () |
If threads are waiting for this Cond, all of them are woken up. More... | |
void | wait (Mutex& mutex) |
Waits until this thread is woken up on this Cond. More... | |
bool | wait_until (Mutex& mutex, gint64 end_time) |
Waits until this thread is woken up on this Cond, but not longer than until the time specified by end_time. More... | |
GCond* | gobj () |
An opaque data structure to represent a condition.
A Cond is an object that threads can block on, if they find a certain condition to be false. If other threads change the state of this condition they can signal the Cond, such that the waiting thread is woken up.
Glib::Threads::Cond::Cond | ( | ) |
Glib::Threads::Cond::~Cond | ( | ) |
void Glib::Threads::Cond::broadcast | ( | ) |
If threads are waiting for this Cond, all of them are woken up.
It is good practice to hold the same lock as the waiting threads, while calling this method, though not required.
|
inline |
void Glib::Threads::Cond::signal | ( | ) |
If threads are waiting for this Cond, exactly one of them is woken up.
It is good practice to hold the same lock as the waiting thread, while calling this method, though not required.
void Glib::Threads::Cond::wait | ( | Mutex& | mutex | ) |
Waits until this thread is woken up on this Cond.
The mutex is unlocked before falling asleep and locked again before resuming.
mutex | A Mutex that is currently locked. |
bool Glib::Threads::Cond::wait_until | ( | Mutex& | mutex, |
gint64 | end_time | ||
) |
Waits until this thread is woken up on this Cond, but not longer than until the time specified by end_time.
The mutex is unlocked before falling asleep and locked again before resuming.
mutex | A Mutex that is currently locked. |
end_time | The monotonic time to wait until, in microseconds. See g_get_monotonic_time(). |
true
if the condition variable was signalled (or in the case of a spurious wakeup), false
if end_time has passed.