[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] Reschedule when a thread blocked on thread-joi
From: |
Evan Hanson |
Subject: |
[Chicken-hackers] [PATCH] Reschedule when a thread blocked on thread-join! is forcibly resumed |
Date: |
Thu, 2 Jun 2016 18:41:22 +1200 |
When a thread that's waiting on another with `thread-join!` is forced to
execute -- usually on an interrupt, when the primordial thread is
forcibly resumed via `##sys#force-primordial` -- it must return control
to the scheduler if it can't yet be unblocked. Otherwise, execution will
return to the point in the program where the interrupt occured, but
without any bookkeeping to prevent that continuation from being executed
*again* on an ensuing call to `##sys#schedule`.
---
srfi-18.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/srfi-18.scm b/srfi-18.scm
index 06ed85f..70dd860 100644
--- a/srfi-18.scm
+++ b/srfi-18.scm
@@ -190,7 +190,9 @@
toval
(##sys#signal
(##sys#make-structure 'condition
'(join-timeout-exception) '())) ) )
- (##sys#thread-block-for-termination! ct thread) ) )
+ (begin
+ (##sys#thread-block-for-termination! ct thread)
+ (##sys#schedule))))
(else
(##sys#error 'thread-join!
"Internal scheduler error: unknown thread state:
"
--
2.8.1