diff options
| author | Thiago Macieira <thiago.macieira@intel.com> | 2025-02-13 16:33:28 -0800 |
|---|---|---|
| committer | Thiago Macieira <thiago.macieira@intel.com> | 2025-08-14 11:36:30 -0700 |
| commit | 51bc150382ade63d91f150168a4c757d63510bc3 (patch) | |
| tree | 5e4bd3935ce4d5013c13539a250b5a658ccaffd8 /src/corelib/thread/qmutex.h | |
| parent | acde39e10206c16fd8b98e1cdf995913d3b9867f (diff) | |
QMutex: mark the uncontended paths as Q_LIKELY
Change-Id: I72ae8d8975c26d1f2e81fffd5839a2500f5edcb6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/corelib/thread/qmutex.h')
| -rw-r--r-- | src/corelib/thread/qmutex.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h index 5753d9faafa..a92fdc79c56 100644 --- a/src/corelib/thread/qmutex.h +++ b/src/corelib/thread/qmutex.h @@ -55,7 +55,7 @@ public: if constexpr (FutexAlwaysAvailable) { // we always unlock if we have futexes - if (QMutexPrivate *d = d_ptr.fetchAndStoreRelease(nullptr); d != dummyLocked()) + if (QMutexPrivate *d = d_ptr.fetchAndStoreRelease(nullptr); Q_UNLIKELY(d != dummyLocked())) unlockInternalFutex(d); // was contended } else { // if we don't have futexes, we can only unlock if not contended @@ -85,7 +85,7 @@ public: private: inline bool fastTryLock() noexcept { - if (d_ptr.loadRelaxed() != nullptr) + if (Q_UNLIKELY(d_ptr.loadRelaxed() != nullptr)) return false; return d_ptr.testAndSetAcquire(nullptr, dummyLocked()); } |
