MADNESS  0.10.1
Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes | List of all members
madness::ConditionVariable Class Reference

Scalable and fair condition variable (spins on local value) More...

#include <worldmutex.h>

Inheritance diagram for madness::ConditionVariable:
Inheritance graph
[legend]
Collaboration diagram for madness::ConditionVariable:
Collaboration graph
[legend]

Public Member Functions

 ConditionVariable ()
 
virtual ~ConditionVariable ()
 
void broadcast () const
 You should acquire the mutex before broadcasting. More...
 
void set_wait_policy (WaitPolicy p, int us=0)
 
void signal () const
 You should acquire the mutex before signalling. More...
 
void wait () const
 You should acquire the mutex before waiting. More...
 
- Public Member Functions inherited from madness::Spinlock
 Spinlock (int junk=0)
 Make and initialize a spinlock ... initial state is unlocked. More...
 
virtual ~Spinlock ()
 
void lock () const
 Acquire the spinlock waiting if necessary. More...
 
bool try_lock () const
 Try to acquire the spinlock ... return true on success, false on failure. More...
 
void unlock () const
 Free a spinlock owned by this thread. More...
 

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)
 

Detailed Description

Scalable and fair condition variable (spins on local value)

Constructor & Destructor Documentation

◆ ConditionVariable()

madness::ConditionVariable::ConditionVariable ( )
inline

◆ ~ConditionVariable()

virtual madness::ConditionVariable::~ConditionVariable ( )
inlinevirtual

Member Function Documentation

◆ broadcast()

void madness::ConditionVariable::broadcast ( ) const
inline

You should acquire the mutex before broadcasting.

References back, front, and signal().

◆ set_wait_policy()

void madness::ConditionVariable::set_wait_policy ( WaitPolicy  p,
int  us = 0 
)
inline

◆ signal()

void madness::ConditionVariable::signal ( ) const
inline

You should acquire the mutex before signalling.

References madness::f, fifo, front, and MAX_NTHREAD.

Referenced by broadcast().

◆ wait()

void madness::ConditionVariable::wait ( ) const
inline

Member Data Documentation

◆ back

int madness::ConditionVariable::back
mutable

Referenced by broadcast(), and wait().

◆ fifo

volatile bool* madness::ConditionVariable::fifo[MAX_NTHREAD]
mutable

Referenced by signal().

◆ front

int madness::ConditionVariable::front
mutable

Referenced by broadcast(), and signal().

◆ MAX_NTHREAD

const int madness::ConditionVariable::MAX_NTHREAD = 128
static

Referenced by signal(), and wait().

◆ wait_policy_

WaitPolicy madness::ConditionVariable::wait_policy_ = WaitPolicy::Busy
private

Referenced by set_wait_policy(), and wait().

◆ wait_usleep_

std::chrono::microseconds madness::ConditionVariable::wait_usleep_ = std::chrono::microseconds(0)
private

Referenced by set_wait_policy(), and wait().


The documentation for this class was generated from the following file: