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

A scalable and fair mutex (not recursive) More...

#include <worldmutex.h>

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

Public Member Functions

 MutexFair ()
 
void lock () const
 
bool try_lock () const
 
void unlock () const
 

Private Attributes

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

Static Private Attributes

static const int MAX_NTHREAD = 128
 

Additional Inherited Members

- Private 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.
 

Detailed Description

A scalable and fair mutex (not recursive)

Needs rewriting to use the CV above and do we really need this if using pthread_mutex .. why not pthread_cv?

Constructor & Destructor Documentation

◆ MutexFair()

madness::MutexFair::MutexFair ( )
inline

Member Function Documentation

◆ lock()

void madness::MutexFair::lock ( ) const
inline

◆ try_lock()

bool madness::MutexFair::try_lock ( ) const
inline

◆ unlock()

void madness::MutexFair::unlock ( ) const
inline

Member Data Documentation

◆ back

int madness::MutexFair::back
mutableprivate

Referenced by lock().

◆ front

int madness::MutexFair::front
mutableprivate

Referenced by unlock().

◆ MAX_NTHREAD

const int madness::MutexFair::MAX_NTHREAD = 128
staticprivate

Referenced by lock(), and unlock().

◆ n

int madness::MutexFair::n
mutableprivate

Referenced by lock(), try_lock(), and unlock().

◆ q

volatile bool* madness::MutexFair::q[MAX_NTHREAD]
mutableprivate

Referenced by lock(), and unlock().


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