QBasicMutex: bring back fastTryUnlock for MSVC

MSVC exports inline functions, so we're not allowed to remove them. This
is an unlikely problem, though, since it was only called from other
inline functions: if the compiler was inlining content into user code
(as it should), then it would likely have inlined this one too; if
instead the inliner was disabled, then it wouldn't have inlined the
caller either.

Amends commit 1957597aa6bc6ebd8bd1f903389800897411ac5d. Seen in API
review.

Pick-to: 6.10
Task-number: QTBUG-137478
Change-Id: Idd01170c3396c5b6fefefffd748f3335fc42fd79
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Thiago Macieira 2025-06-11 10:10:43 -07:00 committed by Marc Mutz
parent 184d0bf2ec
commit 25f396218d
2 changed files with 7 additions and 0 deletions

View File

@ -1461,6 +1461,8 @@ QNoDebug QMessageLogger::noDebug() const noexcept
return QNoDebug();
}
#include "qmutex.h" // removed, previously-inline API
#include "qstring.h" // inlined API
// #include "qotherheader.h"

View File

@ -88,6 +88,11 @@ private:
return false;
return d_ptr.testAndSetAcquire(nullptr, dummyLocked());
}
#if QT_CORE_REMOVED_SINCE(6, 10)
inline bool fastTryUnlock() noexcept {
return d_ptr.testAndSetRelease(dummyLocked(), nullptr);
}
#endif
void lockInternal() noexcept(FutexAlwaysAvailable);
bool lockInternal(QDeadlineTimer timeout) noexcept(FutexAlwaysAvailable);