From 94285814e6e28197513cc800efff2d475f24b2a9 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Tue, 15 Apr 2008 11:54:26 +0000
Subject: [PATCH] SharedLock: restrict assertion condition

When we release a shared lock if there are no exclusive waiter then the number
of shared waiters must be exactly equal to the ones scheduled to pass.

Reviewed-by: iustinp
---
 lib/locking.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/locking.py b/lib/locking.py
index 42fc5f84d..c230be803 100644
--- a/lib/locking.py
+++ b/lib/locking.py
@@ -226,8 +226,7 @@ class SharedLock:
         # If there are shared holders waiting (and not just scheduled to pass)
         # there *must* be an exclusive holder waiting as well; otherwise what
         # were they waiting for?
-        assert (self.__nwait_exc > 0 or self.__npass_shr > 0 or
-                self.__nwait_shr == 0), \
+        assert (self.__nwait_exc > 0 or self.__npass_shr == self.__nwait_shr), \
                "Lock sharers waiting while no exclusive is queueing"
 
         # If there are no more shared holders either in or scheduled to pass,
-- 
GitLab