From 65de109ef379e751e606fcacde5f7a05206e93b9 Mon Sep 17 00:00:00 2001 From: kshitij Date: Fri, 7 Aug 2026 13:46:29 +0530 Subject: [PATCH] fix: notify_all on lock timeout to wake blocked readers When acquire_write or acquire_read times out, call notify_all() before returning False so waiters blocked by the timed-out thread's presence (e.g. readers blocked by writer-preference _writers_waiting > 0) are woken immediately instead of sleeping until the next external notify. --- cron/scheduler.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cron/scheduler.py b/cron/scheduler.py index 2a5a543216..0b3bf7465a 100644 --- a/cron/scheduler.py +++ b/cron/scheduler.py @@ -504,6 +504,7 @@ class _ReadWriteLock: if deadline is not None: remaining = deadline - time.monotonic() if remaining <= 0: + self._cond.notify_all() return False self._cond.wait(timeout=remaining) else: @@ -533,6 +534,7 @@ class _ReadWriteLock: if deadline is not None: remaining = deadline - time.monotonic() if remaining <= 0: + self._cond.notify_all() return False self._cond.wait(timeout=remaining) else: