Qutex: Add currOwner pointer for debugging
We'll use this to detect gridlock-type deadlocks between two requests
This commit is contained in:
@@ -43,6 +43,9 @@ bool Qutex::tryAcquire(
|
||||
if (qNItems == 1 || nRearItemsToScan < 1)
|
||||
{
|
||||
isOwned = true;
|
||||
#ifdef CONFIG_ENABLE_DEBUG_LOCKS
|
||||
currOwner = const_cast<LockerAndInvokerBase*>(&tryingLockvoker);
|
||||
#endif
|
||||
lock.release();
|
||||
return true;
|
||||
}
|
||||
@@ -55,6 +58,9 @@ bool Qutex::tryAcquire(
|
||||
if ((*queue.front()) == tryingLockvoker)
|
||||
{
|
||||
isOwned = true;
|
||||
#ifdef CONFIG_ENABLE_DEBUG_LOCKS
|
||||
currOwner = const_cast<LockerAndInvokerBase*>(&tryingLockvoker);
|
||||
#endif
|
||||
ret = true;
|
||||
}
|
||||
else {
|
||||
@@ -89,6 +95,9 @@ bool Qutex::tryAcquire(
|
||||
|
||||
// Not found in rear portion - must be in top X%, so succeed
|
||||
isOwned = true;
|
||||
#ifdef CONFIG_ENABLE_DEBUG_LOCKS
|
||||
currOwner = const_cast<LockerAndInvokerBase*>(&tryingLockvoker);
|
||||
#endif
|
||||
lock.release();
|
||||
return true;
|
||||
}
|
||||
@@ -220,6 +229,9 @@ void Qutex::backoff(
|
||||
}
|
||||
|
||||
isOwned = false;
|
||||
#ifdef CONFIG_ENABLE_DEBUG_LOCKS
|
||||
currOwner = nullptr;
|
||||
#endif
|
||||
LockerAndInvokerBase &newFront = *queue.front();
|
||||
|
||||
lock.release();
|
||||
@@ -280,6 +292,9 @@ void Qutex::release()
|
||||
lock.acquire();
|
||||
|
||||
isOwned = false;
|
||||
#ifdef CONFIG_ENABLE_DEBUG_LOCKS
|
||||
currOwner = nullptr;
|
||||
#endif
|
||||
|
||||
// It's possible for there to be 0 items left in queue after unregistering.
|
||||
if (queue.empty())
|
||||
|
||||
Reference in New Issue
Block a user