summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/thread/qsemaphore.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp
index f4674fcc1d..c2e4d7d9d1 100644
--- a/src/corelib/thread/qsemaphore.cpp
+++ b/src/corelib/thread/qsemaphore.cpp
@@ -140,6 +140,13 @@ static const quintptr futexNeedsWakeAllBit =
static int futexAvailCounter(quintptr v)
{
// the low 31 bits
+ if (futexHasWaiterCount) {
+ // the high bit of the low word isn't used
+ Q_ASSERT((v & 0x80000000U) == 0);
+
+ // so we can be a little faster
+ return int(unsigned(v));
+ }
return int(v & 0x7fffffffU);
}