The condition variable employed by a
mutex's trylock
() is
an internal condition variable.
A separate object provides condition variable-like semantics:
#include <x/mutex.H> #include <x/mlock.H> #include <x/cond.H> x::mlock lock=m->lock(); x::cond c=x::cond::create(); // ... c->wait(lock); // ... c->notify_all();
x::cond
is a
reference-counted
object that provides
std::condition_variable
-like semantics for
mutexes.
like the mutex object does. It also has an overloaded
wait
() that takes a second parameter that specifies
an optional expiration time.
It implements notify
() and
notify_all
() which are analogous to its
thin, non-reference counted cousin.