dbg:Gridlock detection: exclude locks where hasBeenReleased=true

This commit is contained in:
2026-03-05 23:29:48 -04:00
parent e4332323f9
commit 596ad367e2

View File

@@ -47,7 +47,8 @@ public:
// Return list of all qutexes in predecessors' LockSets; excludes self. // Return list of all qutexes in predecessors' LockSets; excludes self.
[[nodiscard]] [[nodiscard]]
std::unique_ptr<std::forward_list<std::reference_wrapper<Qutex>>> std::unique_ptr<std::forward_list<std::reference_wrapper<Qutex>>>
getAcquiredQutexHistory() const; getAcquiredQutexHistory(
bool includeLocksWhichHaveBeenReleased = false) const;
/** /**
* @brief Release a specific qutex early * @brief Release a specific qutex early
@@ -276,8 +277,8 @@ public:
template <class OriginalCbFnT> template <class OriginalCbFnT>
std::unique_ptr<std::forward_list<std::reference_wrapper<Qutex>>> std::unique_ptr<std::forward_list<std::reference_wrapper<Qutex>>>
SerializedAsynchronousContinuation<OriginalCbFnT>::getAcquiredQutexHistory() SerializedAsynchronousContinuation<OriginalCbFnT>::getAcquiredQutexHistory(
const bool includeLocksWhichHaveBeenReleased) const
{ {
auto heldLocks = std::make_unique< auto heldLocks = std::make_unique<
std::forward_list<std::reference_wrapper<Qutex>>>(); std::forward_list<std::reference_wrapper<Qutex>>>();
@@ -300,6 +301,12 @@ const
// Add this continuation's locks to the held locks list // Add this continuation's locks to the held locks list
for (size_t i = 0; i < heldLockSet->get().locks.size(); ++i) 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); heldLocks->push_front(heldLockSet->get().locks[i].qutex);
} }
} }