From 596ad367e2678092f52428185661e33b8f03867a Mon Sep 17 00:00:00 2001 From: Hayodea Hekol Date: Thu, 5 Mar 2026 23:29:48 -0400 Subject: [PATCH] dbg:Gridlock detection: exclude locks where hasBeenReleased=true --- .../serializedAsynchronousContinuation.h | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/include/spinscale/serializedAsynchronousContinuation.h b/include/spinscale/serializedAsynchronousContinuation.h index e4a06c4..58c6db0 100644 --- a/include/spinscale/serializedAsynchronousContinuation.h +++ b/include/spinscale/serializedAsynchronousContinuation.h @@ -47,7 +47,8 @@ public: // Return list of all qutexes in predecessors' LockSets; excludes self. [[nodiscard]] std::unique_ptr>> - getAcquiredQutexHistory() const; + getAcquiredQutexHistory( + bool includeLocksWhichHaveBeenReleased = false) const; /** * @brief Release a specific qutex early @@ -276,8 +277,8 @@ public: template std::unique_ptr>> -SerializedAsynchronousContinuation::getAcquiredQutexHistory() -const +SerializedAsynchronousContinuation::getAcquiredQutexHistory( + bool includeLocksWhichHaveBeenReleased) const { auto heldLocks = std::make_unique< std::forward_list>>(); @@ -297,12 +298,18 @@ const auto heldLockSet = currContin->getLockSet(); if (!heldLockSet.has_value()) { continue; } - // Add this continuation's locks to the held locks list - for (size_t i = 0; i < heldLockSet->get().locks.size(); ++i) - { - heldLocks->push_front(heldLockSet->get().locks[i].qutex); + // Add this continuation's locks to the held locks list + for (size_t i = 0; i < heldLockSet->get().locks.size(); ++i) + { + if (!includeLocksWhichHaveBeenReleased + && heldLockSet->get().locks[i].hasBeenReleased) + { + continue; + } + + heldLocks->push_front(heldLockSet->get().locks[i].qutex); + } } - } return heldLocks; }