diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2023-05-17 21:54:56 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2023-05-25 08:43:52 -0700 |
commit | 5f531ae2ac873c09deda096d292777422c4dee4d (patch) | |
tree | 180ca3fd4e5a712cf8b904b6a52067f7e4eb45d7 /src/corelib/thread/qmutex.h | |
parent | b5c9eec15c572c72b3fd84abb5f6de7b63f449bd (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/qmutex.h')
-rw-r--r-- | src/corelib/thread/qmutex.h | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h index 8a75db012d..7a6bd1a3ba 100644 --- a/src/corelib/thread/qmutex.h +++ b/src/corelib/thread/qmutex.h @@ -145,12 +145,6 @@ public: return success; } -#ifndef Q_QDOC - // because tryLock(QDeadlineTimer::Forever) is tryLock(0) - bool tryLock(QDeadlineTimer::ForeverConstant) QT_MUTEX_LOCK_NOEXCEPT - { lock(); return true; } -#endif - // TimedLockable concept template <class Rep, class Period> bool try_lock_for(std::chrono::duration<Rep, Period> duration) |