summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qfutex_linux_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/thread/qfutex_linux_p.h')
-rw-r--r--src/corelib/thread/qfutex_linux_p.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/corelib/thread/qfutex_linux_p.h b/src/corelib/thread/qfutex_linux_p.h
index 9291c67623..e114dfca72 100644
--- a/src/corelib/thread/qfutex_linux_p.h
+++ b/src/corelib/thread/qfutex_linux_p.h
@@ -16,10 +16,9 @@
//
#include <private/qcore_unix_p.h>
+#include <qdeadlinetimer.h>
#include <qtsan_impl.h>
-#include <chrono>
-
#include <asm/unistd.h>
#include <errno.h>
#include <limits.h>
@@ -68,10 +67,12 @@ inline void futexWait(Atomic &futex, typename Atomic::Type expectedValue)
_q_futex(addr(&futex), FUTEX_WAIT, qintptr(expectedValue));
}
template <typename Atomic>
-inline bool futexWait(Atomic &futex, typename Atomic::Type expectedValue, std::chrono::nanoseconds timeout)
+inline bool futexWait(Atomic &futex, typename Atomic::Type expectedValue, QDeadlineTimer deadline)
{
+ auto timeout = deadline.deadline<std::chrono::steady_clock>().time_since_epoch();
struct timespec ts = durationToTimespec(timeout);
- int r = _q_futex(addr(&futex), FUTEX_WAIT, qintptr(expectedValue), quintptr(&ts));
+ int r = _q_futex(addr(&futex), FUTEX_WAIT_BITSET, qintptr(expectedValue), quintptr(&ts),
+ nullptr, FUTEX_BITSET_MATCH_ANY);
return r == 0 || errno != ETIMEDOUT;
}
template <typename Atomic> inline void futexWakeOne(Atomic &futex)