cxxtools::ReadWriteMutex Class Reference

Synchronisation device similar to a POSIX rwlock. More...

#include <cxxtools/mutex.h>

Inheritance diagram for cxxtools::ReadWriteMutex:
cxxtools::NonCopyable

Public Member Functions

 ReadWriteMutex ()
 Creates the Reader/Writer lock.
 ~ReadWriteMutex ()
 Destroys the Reader/Writer lock.
void readLock ()
bool tryReadLock ()
 Acquires a read lock.
void writeLock ()
 Acquires a write lock.
bool tryWriteLock ()
 Tries to acquire a write lock.
void unlock ()
 Releases the read or write lock.
bool unlockNoThrow ()

Additional Inherited Members

- Private Member Functions inherited from cxxtools::NonCopyable
 NonCopyable ()

Detailed Description

Synchronisation device similar to a POSIX rwlock.

A ReadWriteMutex allows multiple concurrent readers or one exclusive writer to access a resource.

Constructor & Destructor Documentation

cxxtools::ReadWriteMutex::ReadWriteMutex ( )

Creates the Reader/Writer lock.

cxxtools::ReadWriteMutex::~ReadWriteMutex ( )

Destroys the Reader/Writer lock.

Member Function Documentation

void cxxtools::ReadWriteMutex::readLock ( )
bool cxxtools::ReadWriteMutex::tryReadLock ( )

Acquires a read lock.

If another thread currently holds a write lock, this method waits until the write lock is released.

bool cxxtools::ReadWriteMutex::tryWriteLock ( )

Tries to acquire a write lock.

Immediately returns true if successful, or false if one or more other threads currently hold locks. The result is undefined if the same thread already holds a read or write lock.

void cxxtools::ReadWriteMutex::unlock ( )

Releases the read or write lock.

bool cxxtools::ReadWriteMutex::unlockNoThrow ( )
void cxxtools::ReadWriteMutex::writeLock ( )

Acquires a write lock.

If one or more other threads currently hold locks, this method waits until all locks are released. The results are undefined if the same thread already holds a read or write lock.


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