MADNESS 0.10.1
|
Scalable and fair condition variable (spins on local value) More...
#include <worldmutex.h>
Public Member Functions | |
ConditionVariable () | |
virtual | ~ConditionVariable () |
void | broadcast () const |
You should acquire the mutex before broadcasting. | |
void | set_wait_policy (WaitPolicy p, int us=0) |
void | signal () const |
You should acquire the mutex before signalling. | |
void | wait () const |
You should acquire the mutex before waiting. | |
Public Member Functions inherited from madness::Spinlock | |
Spinlock (int junk=0) | |
Make and initialize a spinlock ... initial state is unlocked. | |
virtual | ~Spinlock () |
void | lock () const |
Acquire the spinlock waiting if necessary. | |
bool | try_lock () const |
Try to acquire the spinlock ... return true on success, false on failure. | |
void | unlock () const |
Free a spinlock owned by this thread. | |
Public Attributes | |
int | back |
volatile bool * | fifo [MAX_NTHREAD] |
int | front |
Static Public Attributes | |
static const int | MAX_NTHREAD = 128 |
Private Attributes | |
WaitPolicy | wait_policy_ = WaitPolicy::Busy |
std::chrono::microseconds | wait_usleep_ = std::chrono::microseconds(0) |
Scalable and fair condition variable (spins on local value)
|
inline |
|
inlinevirtual |
|
inline |
|
inline |
References p(), wait_policy_, and wait_usleep_.
Referenced by madness::DQueue< T >::set_wait_policy().
|
inline |
You should acquire the mutex before signalling.
References madness::f, fifo, front, and MAX_NTHREAD.
Referenced by broadcast().
|
inline |
You should acquire the mutex before waiting.
References b, back, madness::cpu_relax(), madness::Spinlock::lock(), MAX_NTHREAD, madness::Sleep, madness::Spinlock::unlock(), wait_policy_, wait_usleep_, and madness::Yield.
|
mutable |
Referenced by broadcast(), and wait().
|
mutable |
Referenced by signal().
|
mutable |
Referenced by broadcast(), and signal().
|
private |
Referenced by set_wait_policy(), and wait().
|
private |
Referenced by set_wait_policy(), and wait().