summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qmutex.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/thread/qmutex.h')
-rw-r--r--src/corelib/thread/qmutex.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h
index 7a6bd1a3ba..743b86939e 100644
--- a/src/corelib/thread/qmutex.h
+++ b/src/corelib/thread/qmutex.h
@@ -9,6 +9,8 @@
#include <QtCore/qdeadlinetimer.h>
#include <QtCore/qtsan_impl.h>
+#include <chrono>
+
QT_BEGIN_NAMESPACE
#if QT_CONFIG(thread) || defined(Q_QDOC)
@@ -179,8 +181,8 @@ public:
void lock() QT_MUTEX_LOCK_NOEXCEPT
{ tryLock(QDeadlineTimer(QDeadlineTimer::Forever)); }
QT_CORE_INLINE_SINCE(6, 6)
- bool tryLock(int timeout = 0) QT_MUTEX_LOCK_NOEXCEPT;
- bool tryLock(QDeadlineTimer timer) QT_MUTEX_LOCK_NOEXCEPT;
+ bool tryLock(int timeout) QT_MUTEX_LOCK_NOEXCEPT;
+ bool tryLock(QDeadlineTimer timer = {}) QT_MUTEX_LOCK_NOEXCEPT;
// BasicLockable concept
void unlock() noexcept;
@@ -200,12 +202,6 @@ public:
{
return tryLock(QDeadlineTimer(timePoint));
}
-
-#ifndef Q_QDOC
- // because tryLock(QDeadlineTimer::Forever) is tryLock(0)
- bool tryLock(QDeadlineTimer::ForeverConstant) QT_MUTEX_LOCK_NOEXCEPT
- { lock(); return true; }
-#endif
};
#if QT_CORE_INLINE_IMPL_SINCE(6, 6)
@@ -216,7 +212,7 @@ bool QRecursiveMutex::tryLock(int timeout) QT_MUTEX_LOCK_NOEXCEPT
#endif
template <typename Mutex>
-class [[nodiscard]] QMutexLocker
+class QMutexLocker
{
public:
Q_NODISCARD_CTOR
@@ -313,7 +309,7 @@ private:
class QRecursiveMutex : public QMutex {};
template <typename Mutex>
-class [[nodiscard]] QMutexLocker
+class QMutexLocker
{
public:
Q_NODISCARD_CTOR