Instant notification of all waiting readers
This commit is contained in:
parent
90bd33f466
commit
e0f7fe6526
@ -43,7 +43,6 @@ class RwLock(pathutils.RwLock):
|
|||||||
mode == "r" or self._readers == 0))
|
mode == "r" or self._readers == 0))
|
||||||
if mode == "r":
|
if mode == "r":
|
||||||
self._readers += 1
|
self._readers += 1
|
||||||
self._cond.notify()
|
|
||||||
else:
|
else:
|
||||||
self._writer = True
|
self._writer = True
|
||||||
try:
|
try:
|
||||||
@ -53,7 +52,8 @@ class RwLock(pathutils.RwLock):
|
|||||||
if mode == "r":
|
if mode == "r":
|
||||||
self._readers -= 1
|
self._readers -= 1
|
||||||
self._writer = False
|
self._writer = False
|
||||||
self._cond.notify()
|
if self._readers == 0:
|
||||||
|
self._cond.notify_all()
|
||||||
|
|
||||||
|
|
||||||
class LockDict:
|
class LockDict:
|
||||||
|
Loading…
Reference in New Issue
Block a user