QtReadWriteMutex Class Reference
The QtReadWriteMutex class provides read-write locking.
More...
#include <qtreadwritemutex.h>
List of all member functions.
Public Members
void
lock ( AccessMode access )
void
unlock ( AccessMode access )
Detailed Description
The QtReadWriteMutex class provides read-write locking.
It is useful for synchronizing multithreaded access to resources
that support multiple readers, but only one writer.
Member Type Documentation
QtReadWriteMutex::AccessMode
This enum describes the different access types that a thread can specify
when requesting the mutex.
- QtReadWriteMutex::ReadAccess - The thread wants to perform read-operations.
- QtReadWriteMutex::WriteAccess - The thread wants to perform write-operations.
Member Function Documentation
QtReadWriteMutex::QtReadWriteMutex ( int maxreaders = 16 )
Constructs a QtReadWriteMutex object that allows up to maxreaders
threads to lock() the mutex without blocking.
See also lock().
QtReadWriteMutex::~QtReadWriteMutex ()
Destroys the QtReadWriteMutex object.
Warning: If you destroy a read/write mutex that has accesses in use
the resultant behavior is undefined.
void QtReadWriteMutex::lock ( AccessMode access )
Attempts to lock the mutex. This function will block the current thread if
- access is ReadAccess and total() threads are already reading,
or one thread is writing.
- access is WriteAccess and any thread is already reading or writing.
See also unlock().
int QtReadWriteMutex::maxReaders () const
Returns the maximum number of threads that are allowed to read
simulatenously.
void QtReadWriteMutex::unlock ( AccessMode access )
Unlocks the mutex. access must have the same value as in the corresponding
call to lock().
See also lock().
This file is part of the Qt Solutions.
Copyright © 2003-2004
Trolltech. All Rights Reserved.