Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QReadWriteLockPrivate Class Reference

#include <qreadwritelock_p.h>

+ Collaboration diagram for QReadWriteLockPrivate:

Classes

struct  Reader
 

Public Member Functions

 QReadWriteLockPrivate (bool isRecursive=false)
 
bool lockForWrite (std::unique_lock< std::mutex > &lock, QDeadlineTimer timeout)
 
bool lockForRead (std::unique_lock< std::mutex > &lock, QDeadlineTimer timeout)
 
void unlock ()
 
void release ()
 
bool recursiveLockForWrite (QDeadlineTimer timeout)
 
bool recursiveLockForRead (QDeadlineTimer timeout)
 
void recursiveUnlock ()
 

Static Public Member Functions

static QReadWriteLockPrivateallocate ()
 
static QReadWriteLockStates::StateForWaitCondition stateForWaitCondition (const QReadWriteLock *lock)
 

Public Attributes

std::condition_variable writerCond
 
std::condition_variable readerCond
 
std::mutex mutex
 
int readerCount = 0
 
int writerCount = 0
 
int waitingReaders = 0
 
int waitingWriters = 0
 
const bool recursive
 
int id = 0
 
Qt::HANDLE currentWriter = {}
 
QVarLengthArray< Reader, 16 > currentReaders
 

Detailed Description

Definition at line 42 of file qreadwritelock_p.h.

Constructor & Destructor Documentation

◆ QReadWriteLockPrivate()

QReadWriteLockPrivate::QReadWriteLockPrivate ( bool isRecursive = false)
inlineexplicit

Definition at line 45 of file qreadwritelock_p.h.

Member Function Documentation

◆ allocate()

QReadWriteLockPrivate * QReadWriteLockPrivate::allocate ( )
static

Definition at line 562 of file qreadwritelock.cpp.

References d, i, id, and Q_ASSERT.

Referenced by contendedTryLockForRead(), and contendedTryLockForWrite().

+ Here is the caller graph for this function:

◆ lockForRead()

bool QReadWriteLockPrivate::lockForRead ( std::unique_lock< std::mutex > & lock,
QDeadlineTimer timeout )

Definition at line 413 of file qreadwritelock.cpp.

References lock, mutex, Q_ASSERT, readerCond, readerCount, waitingReaders, waitingWriters, and writerCount.

Referenced by recursiveLockForRead().

+ Here is the caller graph for this function:

◆ lockForWrite()

bool QReadWriteLockPrivate::lockForWrite ( std::unique_lock< std::mutex > & lock,
QDeadlineTimer timeout )

Definition at line 434 of file qreadwritelock.cpp.

References lock, mutex, Q_ASSERT, readerCond, readerCount, waitingReaders, waitingWriters, writerCond, and writerCount.

Referenced by recursiveLockForWrite().

+ Here is the caller graph for this function:

◆ recursiveLockForRead()

bool QReadWriteLockPrivate::recursiveLockForRead ( QDeadlineTimer timeout)

Definition at line 477 of file qreadwritelock.cpp.

References currentReaders, QThread::currentThreadId(), handleEquals(), it, lock, lockForRead(), mutex, Q_ASSERT, and recursive.

+ Here is the call graph for this function:

◆ recursiveLockForWrite()

bool QReadWriteLockPrivate::recursiveLockForWrite ( QDeadlineTimer timeout)

Definition at line 499 of file qreadwritelock.cpp.

References QThread::currentThreadId(), currentWriter, lock, lockForWrite(), mutex, Q_ASSERT, recursive, and writerCount.

+ Here is the call graph for this function:

◆ recursiveUnlock()

void QReadWriteLockPrivate::recursiveUnlock ( )

Definition at line 517 of file qreadwritelock.cpp.

References currentReaders, QThread::currentThreadId(), currentWriter, handleEquals(), it, lock, mutex, Q_ASSERT, qWarning, readerCount, recursive, unlock(), and writerCount.

+ Here is the call graph for this function:

◆ release()

void QReadWriteLockPrivate::release ( )

◆ stateForWaitCondition()

QReadWriteLockStates::StateForWaitCondition QReadWriteLockPrivate::stateForWaitCondition ( const QReadWriteLock * q)
inlinestatic

Helper for QWaitCondition::wait

Definition at line 90 of file qreadwritelock_p.h.

References d, and lock.

◆ unlock()

void QReadWriteLockPrivate::unlock ( )

Definition at line 463 of file qreadwritelock.cpp.

References mutex, Q_ASSERT, readerCond, waitingReaders, waitingWriters, and writerCond.

Referenced by recursiveUnlock().

+ Here is the caller graph for this function:

Member Data Documentation

◆ currentReaders

QVarLengthArray<Reader, 16> QReadWriteLockPrivate::currentReaders

Definition at line 76 of file qreadwritelock_p.h.

Referenced by recursiveLockForRead(), and recursiveUnlock().

◆ currentWriter

Qt::HANDLE QReadWriteLockPrivate::currentWriter = {}

Definition at line 69 of file qreadwritelock_p.h.

Referenced by recursiveLockForWrite(), and recursiveUnlock().

◆ id

int QReadWriteLockPrivate::id = 0

Definition at line 64 of file qreadwritelock_p.h.

Referenced by allocate().

◆ mutex

std::mutex QReadWriteLockPrivate::mutex

◆ readerCond

std::condition_variable QReadWriteLockPrivate::readerCond

Definition at line 49 of file qreadwritelock_p.h.

Referenced by lockForRead(), lockForWrite(), and unlock().

◆ readerCount

int QReadWriteLockPrivate::readerCount = 0

Definition at line 52 of file qreadwritelock_p.h.

Referenced by lockForRead(), lockForWrite(), recursiveUnlock(), and release().

◆ recursive

const bool QReadWriteLockPrivate::recursive

◆ waitingReaders

int QReadWriteLockPrivate::waitingReaders = 0

Definition at line 54 of file qreadwritelock_p.h.

Referenced by lockForRead(), lockForWrite(), release(), and unlock().

◆ waitingWriters

int QReadWriteLockPrivate::waitingWriters = 0

Definition at line 55 of file qreadwritelock_p.h.

Referenced by lockForRead(), lockForWrite(), release(), and unlock().

◆ writerCond

std::condition_variable QReadWriteLockPrivate::writerCond

Definition at line 48 of file qreadwritelock_p.h.

Referenced by lockForWrite(), and unlock().

◆ writerCount

int QReadWriteLockPrivate::writerCount = 0

The documentation for this class was generated from the following files: