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

Public Attributes

volatile int back
 
volatile int front
 
volatile bool *volatile q [MAX_NTHREAD]
 

Static Public Attributes

static const int MAX_NTHREAD = 64
 

Detailed Description

Scalable and fair condition variable (spins on local value)

Constructor & Destructor Documentation

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

Member Function Documentation

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

You should acquire the mutex before broadcasting.

References signal().

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

You should acquire the mutex before signalling.

References madness::f, and front.

Referenced by broadcast().

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

You should acquire the mutex before waiting.

References b(), back, madness::cpu_relax(), madness::Spinlock::lock(), TAU_START, TAU_STOP, and madness::Spinlock::unlock().

Member Data Documentation

volatile int madness::ConditionVariable::back
mutable

Referenced by wait().

volatile int madness::ConditionVariable::front
mutable

Referenced by signal().

const int madness::ConditionVariable::MAX_NTHREAD = 64
static
volatile bool* volatile madness::ConditionVariable::q[MAX_NTHREAD]
mutable

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