MADNESS
0.10.1
|
A scalable and fair mutex (not recursive) More...
#include <worldmutex.h>
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. 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... | |
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?
|
inline |
|
inline |
References b, back, madness::cpu_relax(), madness::Spinlock::lock(), MAX_NTHREAD, n, q, and madness::Spinlock::unlock().
|
inline |
References madness::Spinlock::lock(), n, and madness::Spinlock::unlock().
|
inline |
References madness::f, front, madness::Spinlock::lock(), MAX_NTHREAD, n, p(), q, and madness::Spinlock::unlock().
|
mutableprivate |
Referenced by lock().
|
mutableprivate |
Referenced by unlock().
|
mutableprivate |
Referenced by lock(), try_lock(), and unlock().
|
mutableprivate |