LockSet:tryAcquireOrBackoff use optional<ref_wrapper<Qutex>>

Replace the previous Qutex** raw pointer with a std::optional.
This commit is contained in:
2025-09-30 10:36:19 -04:00
parent e3ce533fe4
commit f15c07bc83
3 changed files with 10 additions and 10 deletions
+3 -5
View File
@@ -107,14 +107,12 @@ public:
"executing on wrong ComponentThread");
}
Qutex *firstFailedQutexPtr = nullptr;
std::optional<std::reference_wrapper<Qutex>> firstFailedQutexRet;
bool deadlockLikely = isDeadlockLikely();
bool gridlockLikely = isGridlockLikely();
if (!serializedContinuation.requiredLocks.tryAcquireOrBackOff(
*this,
((deadlockLikely || gridlockLikely)
? &firstFailedQutexPtr : nullptr)))
*this, firstFailedQutexRet))
{
// Just allow this lockvoker to be dropped from its io_service.
allowAwakening();
@@ -122,7 +120,7 @@ public:
{ return; }
#ifdef CONFIG_ENABLE_DEBUG_LOCKS
Qutex &firstFailedQutex = *firstFailedQutexPtr;
Qutex &firstFailedQutex = firstFailedQutexRet.value().get();
bool isDeadlock = traceContinuationHistoryForDeadlockOn(
firstFailedQutex);