framexmit::readwritelock Class Reference
[Frame multicast client/server]

#include <fxmitmutex.hh>

Inheritance diagram for framexmit::readwritelock:

framexmit::abstractsemaphore

List of all members.

Public Member Functions

 readwritelock (int Maxuse=-1)
virtual ~readwritelock ()
 readwritelock (const readwritelock &rw)
readwritelockoperator= (const readwritelock &rw)
virtual void readlock ()
virtual void writelock ()
virtual void lock ()
virtual void unlock ()
bool trylock (locktype lck=rdlock)


Detailed Description

This class is used to implement a read/write lock. A read/write lock can be locked by multple readers simultaneously. A writer owns the lock exclusively. The maximum number of readers can be specified during creation. Writers have priority over readers, meaning if a request from a writer is pending, no further read access is granted. Then, after all readers have returned the lock, the writer will get granted access first. When passing a read/write lock object to a function it has to be passed by reference or by pointer (never by value because the copy operator is disabled for read/write locks).

brief Class to store a read/write lock.

Author:
DS, November 98
See also:
Recursive mutex objects

Constructor & Destructor Documentation

framexmit::readwritelock::readwritelock ( int  Maxuse = -1  )  [inline, explicit]

Constructs a read/write lock. Takes the maxumum number of concurrent read locks as argument; a number equal or less zero represents unlimited read access. brief Default constructor.

Parameters:
Maxuse maximum number of readers
Returns:
void

virtual framexmit::readwritelock::~readwritelock (  )  [virtual]

Destructs the read/write lock. brief Default destructor.

Returns:
void

framexmit::readwritelock::readwritelock ( const readwritelock rw  )  [inline]

Constructs a read/write lock, overwritting the default copy constructor by creating a new read/write lock. brief Copy constructor.

Returns:
void


Member Function Documentation

readwritelock& framexmit::readwritelock::operator= ( const readwritelock rw  )  [inline]

Overrides the default assignment behaviour. Does nothing. brief Assignment operator.

Parameters:
rw readwritelock copy argument
Returns:
refrence to object

virtual void framexmit::readwritelock::readlock (  )  [virtual]

Locks the lock for read. Multiple read locks (up to maxuse) can be granted, but only one write lock at any given time. If a write lock is requested while the lock is given to one or more readers, no further read locks will be granted to prevent the write task from starvation. (Write locks have absolute priority.) brief Read/write-lock lock function.

Returns:
void

Implements framexmit::abstractsemaphore.

virtual void framexmit::readwritelock::writelock (  )  [virtual]

Locks the lock for write. Multiple read locks (up to maxuse) can be granted, but only one write lock at any given time. If a write lock is requested while the lock is given to one or more readers, no further read locks will be granted to prevent the write task from starvation. (Write locks have absolute priority.) brief Read/write-lock lock function.

Returns:
void

Implements framexmit::abstractsemaphore.

virtual void framexmit::readwritelock::lock (  )  [inline, virtual]

Locks the lock for read; same as readlock(). brief Read/write-lock lock function.

Returns:
void

Implements framexmit::abstractsemaphore.

virtual void framexmit::readwritelock::unlock (  )  [virtual]

Unlocks the read/write lock. brief Read/write-lock unlock function.

Returns:
void

Implements framexmit::abstractsemaphore.

bool framexmit::readwritelock::trylock ( locktype  lck = rdlock  )  [virtual]

Trys to lock the read/write lock. To return true and locked, either a writer attemps to lock a free lock, or a reader attemps to obtain a lock which is not owned by a writer. Otherwise the function returns false and without the lock.

brief Read/write-lock trylock function.

Parameters:
lck Lock type (rdlock/wrlock)
Returns:
true if locked, false otherwise

Implements framexmit::abstractsemaphore.


The documentation for this class was generated from the following file:
Generated on Sun Mar 8 19:21:24 2009 for dmt by  doxygen 1.5.4