mirror of
https://github.com/latentPrion/libspinscale.git
synced 2026-04-17 22:44:25 +00:00
Dbg:traceContinHistForDeadlock: consult LockUsageDesc::hasBeenReleased
Don't raise the alarm for a deadlock if the lock has already been released at the moment of checking.
This commit is contained in:
@@ -197,15 +197,52 @@ public:
|
||||
allLocksAcquired = false;
|
||||
}
|
||||
|
||||
const LockUsageDesc &getLockUsageDesc(const Qutex &criterionLock) const
|
||||
std::optional<std::reference_wrapper<LockUsageDesc>>
|
||||
findLockUsageDesc(const Qutex &criterionLock)
|
||||
{
|
||||
for (auto& lockUsageDesc : locks)
|
||||
{
|
||||
if (&lockUsageDesc.qutex.get() == &criterionLock) {
|
||||
return lockUsageDesc;
|
||||
return std::ref(lockUsageDesc);
|
||||
}
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<std::reference_wrapper<const LockUsageDesc>>
|
||||
findLockUsageDesc(const Qutex &criterionLock) const
|
||||
{
|
||||
for (const auto& lockUsageDesc : locks)
|
||||
{
|
||||
if (&lockUsageDesc.qutex.get() == &criterionLock) {
|
||||
return std::cref(lockUsageDesc);
|
||||
}
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
LockUsageDesc &getLockUsageDesc(const Qutex &criterionLock)
|
||||
{
|
||||
auto lockUsageDesc = findLockUsageDesc(criterionLock);
|
||||
if (lockUsageDesc.has_value()) {
|
||||
return lockUsageDesc->get();
|
||||
}
|
||||
|
||||
// Should never happen if the LockSet is properly constructed
|
||||
throw std::runtime_error(
|
||||
std::string(__func__) +
|
||||
": Qutex not found in this LockSet");
|
||||
}
|
||||
|
||||
const LockUsageDesc &getLockUsageDesc(const Qutex &criterionLock) const
|
||||
{
|
||||
auto lockUsageDesc = findLockUsageDesc(criterionLock);
|
||||
if (lockUsageDesc.has_value()) {
|
||||
return lockUsageDesc->get();
|
||||
}
|
||||
|
||||
// Should never happen if the LockSet is properly constructed
|
||||
throw std::runtime_error(
|
||||
std::string(__func__) +
|
||||
@@ -225,8 +262,7 @@ public:
|
||||
": LockSet::releaseQutexEarly() called but allLocksAcquired is false");
|
||||
}
|
||||
|
||||
auto& lockUsageDesc = const_cast<LockUsageDesc&>(
|
||||
getLockUsageDesc(qutex));
|
||||
auto& lockUsageDesc = getLockUsageDesc(qutex);
|
||||
|
||||
if (!lockUsageDesc.hasBeenReleased)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user