From c1468c8022092e392ee98a51ed9a4574e4ca5e68 Mon Sep 17 00:00:00 2001 From: Chris Vine Date: Wed, 17 Nov 2021 15:39:04 +0000 Subject: [PATCH] Unwind on exception in event loop --- a-sync/event-loop.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/a-sync/event-loop.scm b/a-sync/event-loop.scm index f7018d0..5b1f81d 100644 --- a/a-sync/event-loop.scm +++ b/a-sync/event-loop.scm @@ -515,8 +515,10 @@ ;; now reset the operating mode when not closed (when (not (eq? mode 'closed)) (_mode-set! el #f))))) - ;; as the handler always rethrows, we do not need to unwind here - #:unwind? #f)) + ;; as the exception handler locks the event loop mutex for + ;; house-keeping, unwind the stack to ensure that any with-mutex + ;; forms have unlocked by the time we enter the handler + #:unwind? #t)) ;; This procedure is only called in the event loop thread, by ;; event-loop-run! It must be called while holding the event loop