Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

ReadWriteMutex Class Reference

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

#include <cxxtools/mutex.h>

Inheritance diagram for ReadWriteMutex:

List of all members.

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 ()


Detailed Description

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

Member Function Documentation

bool tryReadLock (  ) 

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

void writeLock (  ) 

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.

bool tryWriteLock (  ) 

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.

Copyright © 2008 The Tntnet Development Team
Tntnet 1.6