QReadWriteLock: use NSDMI to simplify the Private ctor
Change-Id: I7267dedb152186ad8c74cbf2eddd863c3bc0845f Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
e8bca8e763
commit
0f219d2054
@ -63,17 +63,16 @@ QT_BEGIN_NAMESPACE
|
||||
class QReadWriteLockPrivate
|
||||
{
|
||||
public:
|
||||
QReadWriteLockPrivate(bool isRecursive = false)
|
||||
: readerCount(0), writerCount(0), waitingReaders(0), waitingWriters(0),
|
||||
recursive(isRecursive), id(0), currentWriter(nullptr) {}
|
||||
explicit QReadWriteLockPrivate(bool isRecursive = false)
|
||||
: recursive(isRecursive) {}
|
||||
|
||||
QMutex mutex;
|
||||
QWaitCondition writerCond;
|
||||
QWaitCondition readerCond;
|
||||
int readerCount;
|
||||
int writerCount;
|
||||
int waitingReaders;
|
||||
int waitingWriters;
|
||||
int readerCount = 0;
|
||||
int writerCount = 0;
|
||||
int waitingReaders = 0;
|
||||
int waitingWriters = 0;
|
||||
const bool recursive;
|
||||
|
||||
//Called with the mutex locked
|
||||
@ -82,19 +81,18 @@ public:
|
||||
void unlock();
|
||||
|
||||
//memory management
|
||||
int id;
|
||||
int id = 0;
|
||||
void release();
|
||||
static QReadWriteLockPrivate *allocate();
|
||||
|
||||
// Recusive mutex handling
|
||||
Qt::HANDLE currentWriter;
|
||||
Qt::HANDLE currentWriter = {};
|
||||
QHash<Qt::HANDLE, int> currentReaders;
|
||||
|
||||
// called with the mutex unlocked
|
||||
bool recursiveLockForWrite(int timeout);
|
||||
bool recursiveLockForRead(int timeout);
|
||||
void recursiveUnlock();
|
||||
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
Loading…
Reference in New Issue
Block a user