MADNESS  version 0.9
Public Member Functions | Static Public Attributes | List of all members
madness::MutexReaderWriter Class Reference

#include <worldmutex.h>

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

Public Member Functions

 MutexReaderWriter ()
 
bool try_read_lock () const
 
bool try_write_lock () const
 
bool try_lock (int lockmode) const
 
bool try_convert_read_lock_to_write_lock () const
 
void read_lock () const
 
void write_lock () const
 
void lock (int lockmode) const
 
void read_unlock () const
 
void write_unlock () const
 
void unlock (int lockmode) const
 
void convert_read_lock_to_write_lock () const
 Converts read to write lock without releasing the read lock. More...
 
void convert_write_lock_to_read_lock () const
 Always succeeds immediately. More...
 
virtual ~MutexReaderWriter ()
 

Static Public Attributes

static const int NOLOCK =0
 
static const int READLOCK =1
 
static const int WRITELOCK =2
 

Constructor & Destructor Documentation

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

Member Function Documentation

void madness::MutexReaderWriter::convert_read_lock_to_write_lock ( ) const
inline

Converts read to write lock without releasing the read lock.

Note that deadlock is guaranteed if two+ threads wait to convert at the same time.

References madness::cpu_relax(), and try_convert_read_lock_to_write_lock().

void madness::MutexReaderWriter::convert_write_lock_to_read_lock ( ) const
inline

Always succeeds immediately.

void madness::MutexReaderWriter::lock ( int  lockmode) const
inline
void madness::MutexReaderWriter::read_lock ( ) const
inline
void madness::MutexReaderWriter::read_unlock ( ) const
inline

Referenced by unlock().

bool madness::MutexReaderWriter::try_convert_read_lock_to_write_lock ( ) const
inline
bool madness::MutexReaderWriter::try_lock ( int  lockmode) const
inline
bool madness::MutexReaderWriter::try_read_lock ( ) const
inline

Referenced by read_lock(), and try_lock().

bool madness::MutexReaderWriter::try_write_lock ( ) const
inline

Referenced by try_lock(), and write_lock().

void madness::MutexReaderWriter::unlock ( int  lockmode) const
inline
void madness::MutexReaderWriter::write_lock ( ) const
inline
void madness::MutexReaderWriter::write_unlock ( ) const
inline

Referenced by unlock().

Member Data Documentation

const int madness::MutexReaderWriter::NOLOCK =0
static
const int madness::MutexReaderWriter::READLOCK =1
static
const int madness::MutexReaderWriter::WRITELOCK =2
static

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