diff --git a/src/corelib/kernel/qdeadlinetimer.h b/src/corelib/kernel/qdeadlinetimer.h index dab5e055ae0..b872422add0 100644 --- a/src/corelib/kernel/qdeadlinetimer.h +++ b/src/corelib/kernel/qdeadlinetimer.h @@ -23,7 +23,8 @@ QT_BEGIN_NAMESPACE class Q_CORE_EXPORT QDeadlineTimer { public: - enum ForeverConstant { Forever }; + enum class ForeverConstant { Forever }; + static constexpr ForeverConstant Forever = ForeverConstant::Forever; constexpr QDeadlineTimer(Qt::TimerType type_ = Qt::CoarseTimer) noexcept : type(type_) {} diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h index 8a75db012d3..7a6bd1a3ba7 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 bool try_lock_for(std::chrono::duration duration) diff --git a/src/corelib/thread/qreadwritelock.h b/src/corelib/thread/qreadwritelock.h index 352aaab2cf5..a00c0262fa7 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 d_ptr; diff --git a/src/corelib/thread/qsemaphore.h b/src/corelib/thread/qsemaphore.h index f20bef42882..0e01f33f36c 100644 --- a/src/corelib/thread/qsemaphore.h +++ b/src/corelib/thread/qsemaphore.h @@ -23,11 +23,6 @@ public: QT_CORE_INLINE_SINCE(6, 6) bool tryAcquire(int n, int timeout); bool tryAcquire(int n, QDeadlineTimer timeout); -#ifndef Q_QDOC - // because tryAcquire(n, QDeadlineTimer::Forever) is tryLock(n, 0) - bool tryAcquire(int n, QDeadlineTimer::ForeverConstant) - { acquire(n); return true; } -#endif #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) template bool tryAcquire(int n, std::chrono::duration timeout)