Commit 94285814 authored by Guido Trotter's avatar Guido Trotter
Browse files

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
parent 40dacb4d
......@@ -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,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment