Debug:Qutex: Add deadlock detection based on elapsed time
We now detect that a deadlock is likely when CONFIG_DEBUG_QUTEX_DEADLOCK_TIMEOUT_MS has elapsed. This is the preliminary work required to do a backtrace through the call stack and figure out if a deadlock has really occured. To do this, we'd have to go through the async call chain and search for a previous caller which acquired the same qutex as the one that first failed during this Lockvoker LockSet acquisition attempt.
This commit is contained in:
+7
-1
@@ -47,7 +47,9 @@ void LockSet<OriginalCbFnT>::registerInQutexQueues(
|
||||
}
|
||||
|
||||
template <class OriginalCbFnT>
|
||||
bool LockSet<OriginalCbFnT>::tryAcquireOrBackOff(LockerAndInvokerBase &lockvoker)
|
||||
bool LockSet<OriginalCbFnT>::tryAcquireOrBackOff(
|
||||
LockerAndInvokerBase &lockvoker, Qutex *firstFailedQutex
|
||||
)
|
||||
{
|
||||
if (!registeredInQutexQueues)
|
||||
{
|
||||
@@ -72,6 +74,10 @@ bool LockSet<OriginalCbFnT>::tryAcquireOrBackOff(LockerAndInvokerBase &lockvoker
|
||||
if (!lockUsageDesc.first.get().tryAcquire(
|
||||
lockvoker, nRequiredLocks))
|
||||
{
|
||||
// Set the first failed qutex for debugging
|
||||
if (firstFailedQutex) {
|
||||
*firstFailedQutex = &lockUsageDesc.first.get();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user