diff options
author | Liang Qi <liang.qi@qt.io> | 2017-02-24 19:57:17 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-02-24 20:01:42 +0100 |
commit | de49839df8abfba1f3ed3c36ef3177e4a9d6ef00 (patch) | |
tree | 71e777ca1e33c58edd9149821e970495ef4b75b2 /src/corelib/thread | |
parent | e6234535929c67e7fbfa1ad7ce88f37df0b68d45 (diff) | |
parent | 4d3781b640e8fb0a04e96b2d05199247556b8d86 (diff) |
Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
mkspecs/features/moc.prf
Change-Id: Ia71c8e3b3185f7c999bf226d0675051b10b8740b
Diffstat (limited to 'src/corelib/thread')
-rw-r--r-- | src/corelib/thread/qreadwritelock.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp index 6302a3a515..42befc4b80 100644 --- a/src/corelib/thread/qreadwritelock.cpp +++ b/src/corelib/thread/qreadwritelock.cpp @@ -392,13 +392,13 @@ bool QReadWriteLock::tryLockForWrite(int timeout) */ void QReadWriteLock::unlock() { - QReadWriteLockPrivate *d = d_ptr.load(); + QReadWriteLockPrivate *d = d_ptr.loadAcquire(); while (true) { Q_ASSERT_X(d, "QReadWriteLock::unlock()", "Cannot unlock an unlocked lock"); // Fast case: no contention: (no waiters, no other readers) if (quintptr(d) <= 2) { // 1 or 2 (StateLockedForRead or StateLockedForWrite) - if (!d_ptr.testAndSetRelease(d, nullptr, d)) + if (!d_ptr.testAndSetOrdered(d, nullptr, d)) continue; return; } @@ -407,7 +407,7 @@ void QReadWriteLock::unlock() Q_ASSERT(quintptr(d) > (1U<<4)); //otherwise that would be the fast case // Just decrease the reader's count. auto val = reinterpret_cast<QReadWriteLockPrivate *>(quintptr(d) - (1U<<4)); - if (!d_ptr.testAndSetRelease(d, val, d)) + if (!d_ptr.testAndSetOrdered(d, val, d)) continue; return; } |