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.

Task-number: QTBUG-137478
Change-Id: Idd01170c3396c5b6fefefffd748f3335fc42fd79
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 25f396218d2eb86607a88b4f76edee7f78948816)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2025-06-11 10:10:43 -07:00 committed by Qt Cherry-pick Bot
parent d6fb65adb0
commit 2d2dd3aa2e
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);