summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qreadwritelock.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-05-17 21:54:56 -0700
committerThiago Macieira <thiago.macieira@intel.com>2023-05-25 08:43:52 -0700
commit5f531ae2ac873c09deda096d292777422c4dee4d (patch)
tree180ca3fd4e5a712cf8b904b6a52067f7e4eb45d7 /src/corelib/thread/qreadwritelock.h
parentb5c9eec15c572c72b3fd84abb5f6de7b63f449bd (diff)
QDeadlineTimer: make the ForeverConstant an enum class
Avoids the implicit cast to int, which then fixes the overloading problem of QDeadlineTimer with older functions taking an integer with the number of milliseconds. Without this and the workarounds, an expression like waitCondition.wait(&mutex, QDeadlineTimer::Forever); would be the same as waitCondition.wait(&mutex, 0); which is the opposite of "forever". This means we can remove the overloads added earlier this week in commits 37f1fb78eeb107d593f9a7bf0491466a1c60e068 (QMutex), 63704529b75f831ffeb965765c10caf09f7883fe (QReadWriteLock), and 37f1fb78eeb107d593f9a7bf0491466a1c60e068 (QSemaphore). I hadn't thought this solution until noting that QWaitCondition needed the same solution and then remembering how Qt::Uninitialized was fixed of the same problem. Change-Id: I5f7f427ded124479baa6fffd176023ddfb91077d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/thread/qreadwritelock.h')
-rw-r--r--src/corelib/thread/qreadwritelock.h9
1 files changed, 0 insertions, 9 deletions
diff --git a/src/corelib/thread/qreadwritelock.h b/src/corelib/thread/qreadwritelock.h
index 352aaab2cf..a00c0262fa 100644
--- a/src/corelib/thread/qreadwritelock.h
+++ b/src/corelib/thread/qreadwritelock.h
@@ -43,15 +43,6 @@ public:
void unlock();
-#ifndef Q_QDOC
- // because tryLockForXxx(QDeadlineTimer::Forever) is the same
- // as tryLockForXxx(0), which is not forever
- bool tryLockForRead(QDeadlineTimer::ForeverConstant)
- { lockForRead(); return true; }
- bool tryLockForWrite(QDeadlineTimer::ForeverConstant)
- { lockForWrite(); return true; }
-#endif
-
private:
Q_DISABLE_COPY(QReadWriteLock)
QAtomicPointer<QReadWriteLockPrivate> d_ptr;