Home

QtReadWriteMutex Class Reference

The QtReadWriteMutex class provides read-write locking. More...

#include <qtreadwritemutex.h>

List of all member functions.

Public Members


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.


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

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.

Copyright © 2003-2004 TrolltechTrademarks
Qt Solutions