Instant notification of all waiting readers

This commit is contained in:
Unrud 2021-12-12 19:36:23 +01:00
parent 90bd33f466
commit e0f7fe6526

View File

@ -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: