Qutex: Add check for double-release()
This commit is contained in:
+17
-7
@@ -295,14 +295,24 @@ void Qutex::release()
|
|||||||
{
|
{
|
||||||
lock.acquire();
|
lock.acquire();
|
||||||
|
|
||||||
isOwned = false;
|
/** EXPLAINATION:
|
||||||
/** FIXME:
|
* A qutex must not have its release() called when it's not owned. The
|
||||||
* We need to be able to call this twice or more from the same request.
|
* plumbing required to permit that is a bit excessive, and we have
|
||||||
* We can either add further metadata to this class, or we can force all
|
* instrumentation to track early qutex release()ing in
|
||||||
* release() calls to be done via the Continuation object, such that it
|
* SerializedAsynchronousContinuation.
|
||||||
* can ensure that it doesn't double-release any locks that were released
|
|
||||||
* early.
|
|
||||||
*/
|
*/
|
||||||
|
if (!isOwned
|
||||||
|
#ifdef CONFIG_ENABLE_DEBUG_LOCKS
|
||||||
|
|| currOwner == nullptr
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
|
throw std::runtime_error(
|
||||||
|
std::string(__func__) +
|
||||||
|
": release() called on unowned qutex - this should never happen");
|
||||||
|
}
|
||||||
|
|
||||||
|
isOwned = false;
|
||||||
#ifdef CONFIG_ENABLE_DEBUG_LOCKS
|
#ifdef CONFIG_ENABLE_DEBUG_LOCKS
|
||||||
currOwner = nullptr;
|
currOwner = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user