ReadWriteLock Class Reference

A critical section that allows multiple simultaneous readers. More...

List of all members.

Public Member Functions

 ReadWriteLock () throw ()
 Creates a ReadWriteLock object.
 ~ReadWriteLock () throw ()
 Destructor.
void enterRead () const throw ()
 Locks this object for reading.
void exitRead () const throw ()
 Releases the read-lock.
void enterWrite () const throw ()
 Locks this object for writing.
bool tryEnterWrite () const throw ()
 Tries to lock this object for writing.
void exitWrite () const throw ()
 Releases the write-lock.

Detailed Description

A critical section that allows multiple simultaneous readers.

Features of this type of lock are:

See also:
ScopedReadLock, ScopedWriteLock, CriticalSection

Constructor & Destructor Documentation

ReadWriteLock::ReadWriteLock (  )  throw ()

Creates a ReadWriteLock object.

ReadWriteLock::~ReadWriteLock (  )  throw ()

Destructor.

If the object is deleted whilst locked, any subsequent behaviour is unpredictable.


Member Function Documentation

void ReadWriteLock::enterRead (  )  const throw ()

Locks this object for reading.

Multiple threads can simulaneously lock the object for reading, but if another thread has it locked for writing, then this will block until it releases the lock.

See also:
exitRead, ScopedReadLock
void ReadWriteLock::exitRead (  )  const throw ()

Releases the read-lock.

If the caller thread hasn't got the lock, this can have unpredictable results.

If the enterRead() method has been called multiple times by the thread, each call must be matched by a call to exitRead() before other threads will be allowed to take over the lock.

See also:
enterRead, ScopedReadLock
void ReadWriteLock::enterWrite (  )  const throw ()

Locks this object for writing.

This will block until any other threads that have it locked for reading or writing have released their lock.

See also:
exitWrite, ScopedWriteLock
bool ReadWriteLock::tryEnterWrite (  )  const throw ()

Tries to lock this object for writing.

This is like enterWrite(), but doesn't block - it returns true if it manages to obtain the lock.

See also:
enterWrite
void ReadWriteLock::exitWrite (  )  const throw ()

Releases the write-lock.

If the caller thread hasn't got the lock, this can have unpredictable results.

If the enterWrite() method has been called multiple times by the thread, each call must be matched by a call to exit() before other threads will be allowed to take over the lock.

See also:
enterWrite, ScopedWriteLock

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Mon Apr 26 11:42:16 2010 for JUCE by  doxygen 1.6.3