Qutex: nRequiredLocks==1 at front should never call backoff

This commit is contained in:
2025-10-04 14:48:38 -04:00
parent 168d8d616c
commit 3a50be05f8
+18 -1
View File
@@ -123,8 +123,25 @@ void Qutex::backoff(
": backoff called on empty queue - this should never happen"); ": backoff called on empty queue - this should never happen");
} }
/* Check if failedAcquirer is at the front of the queue with
* nRequiredLocks == 1. This should never happen because an
* acquirer at the front of the queue with nRequiredLocks == 1
* should always succeed.
*/
const LockerAndInvokerBase& oldFront = *queue.front();
if (oldFront == failedAcquirer && nRequiredLocks == 1)
{
lock.release();
throw std::runtime_error(
std::string(__func__) +
": Failed acquirer is at front of queue with nRequiredLocks==1 - "
"acquirer at front of queue with nRequiredLocks==1 should always "
"succeed.");
}
// Rotate queue members if failedAcquirer is at front of queue // Rotate queue members if failedAcquirer is at front of queue
if ((*queue.front()) == failedAcquirer && nQItems > 1) if (oldFront == failedAcquirer && nQItems > 1)
{ {
/** EXPLANATION: /** EXPLANATION:
* Rotate the top LockSet.size() items in the queue by moving * Rotate the top LockSet.size() items in the queue by moving