~ chicken-core (chicken-5) 551d98cd1f2000935837f479de4158296ab1fa02
commit 551d98cd1f2000935837f479de4158296ab1fa02 Author: Evan Hanson <evhan@foldling.org> AuthorDate: Thu Jun 2 18:41:22 2016 +1200 Commit: Peter Bex <peter@more-magic.net> CommitDate: Thu Jul 14 21:12:58 2016 +0200 Reschedule when a thread blocked on thread-join! is forcibly resumed 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`. Signed-off-by: Peter Bex <peter@more-magic.net> diff --git a/srfi-18.scm b/srfi-18.scm index 4fe52c4e..7044039f 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"Trap