diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2023-04-27 21:29:07 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2023-05-11 12:31:57 -0700 |
commit | ff9da1db0b0963f967f45ab430ec40a3051b70b4 (patch) | |
tree | 382c6ded0b26412178c282b175b4949504d9c868 /src/corelib/thread/qmutex_p.h | |
parent | 63704529b75f831ffeb965765c10caf09f7883fe (diff) |
QMutex: add QDeadlineTimer-based tryLocks
This simplifies the code greatly, because we don't need to use
QtPrivate::convertToMilliseconds any more, as QDeadlineTimer has
nanosecond precision.
Internally it becomes simpler too because lockInternal was already using
QDeadlineTimer. I just had to use the parameter instead and update the
two non-futex implementations to take it again. This may even be fixing
a mistake in case sem_timedwait(2) got interrupted.
Change-Id: I6f518d59e63249ddbf43fffd1759fed9f50b3606
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/thread/qmutex_p.h')
-rw-r--r-- | src/corelib/thread/qmutex_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/thread/qmutex_p.h b/src/corelib/thread/qmutex_p.h index e02686ad68..aabb66fa55 100644 --- a/src/corelib/thread/qmutex_p.h +++ b/src/corelib/thread/qmutex_p.h @@ -43,7 +43,7 @@ public: ~QMutexPrivate(); QMutexPrivate(); - bool wait(int timeout = -1); + bool wait(QDeadlineTimer timeout = QDeadlineTimer::Forever); void wakeUp() noexcept; // Control the lifetime of the privates |