Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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 43 of file qreadwritelock_p.h.

Constructor & Destructor Documentation

◆ QReadWriteLockPrivate()

QReadWriteLockPrivate::QReadWriteLockPrivate ( bool isRecursive = false)
inlineexplicit

Definition at line 46 of file qreadwritelock_p.h.

References recursive.

Member Function Documentation

◆ allocate()

QReadWriteLockPrivate * QReadWriteLockPrivate::allocate ( )
static

Definition at line 565 of file qreadwritelock.cpp.

References id, readerCount, recursive, waitingReaders, waitingWriters, and writerCount.

◆ lockForRead()

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

Definition at line 416 of file qreadwritelock.cpp.

References readerCond, readerCount, waitingReaders, waitingWriters, and writerCount.

◆ lockForWrite()

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

◆ recursiveLockForRead()

bool QReadWriteLockPrivate::recursiveLockForRead ( QDeadlineTimer timeout)

Definition at line 480 of file qreadwritelock.cpp.

References recursive.

◆ recursiveLockForWrite()

bool QReadWriteLockPrivate::recursiveLockForWrite ( QDeadlineTimer timeout)

Definition at line 502 of file qreadwritelock.cpp.

References recursive, and writerCount.

◆ recursiveUnlock()

void QReadWriteLockPrivate::recursiveUnlock ( )

Definition at line 520 of file qreadwritelock.cpp.

References readerCount, recursive, unlock(), and writerCount.

Here is the call graph for this function:

◆ release()

void QReadWriteLockPrivate::release ( )

Definition at line 575 of file qreadwritelock.cpp.

References readerCount, recursive, waitingReaders, waitingWriters, and writerCount.

◆ stateForWaitCondition()

◆ unlock()

void QReadWriteLockPrivate::unlock ( )

Definition at line 466 of file qreadwritelock.cpp.

References 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 77 of file qreadwritelock_p.h.

◆ currentWriter

Qt::HANDLE QReadWriteLockPrivate::currentWriter = {}

Definition at line 70 of file qreadwritelock_p.h.

◆ id

int QReadWriteLockPrivate::id = 0

Definition at line 65 of file qreadwritelock_p.h.

Referenced by allocate().

◆ mutex

std::mutex QReadWriteLockPrivate::mutex

Definition at line 52 of file qreadwritelock_p.h.

◆ readerCond

std::condition_variable QReadWriteLockPrivate::readerCond

Definition at line 50 of file qreadwritelock_p.h.

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

◆ readerCount

int QReadWriteLockPrivate::readerCount = 0

Definition at line 53 of file qreadwritelock_p.h.

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

◆ recursive

const bool QReadWriteLockPrivate::recursive

◆ waitingReaders

int QReadWriteLockPrivate::waitingReaders = 0

Definition at line 55 of file qreadwritelock_p.h.

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

◆ waitingWriters

int QReadWriteLockPrivate::waitingWriters = 0

Definition at line 56 of file qreadwritelock_p.h.

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

◆ writerCond

std::condition_variable QReadWriteLockPrivate::writerCond

Definition at line 49 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: