diff options
| author | Andy Wingo <wingo@pobox.com> | 2017-01-06 21:25:39 +0100 |
|---|---|---|
| committer | Andy Wingo <wingo@pobox.com> | 2017-01-06 21:25:39 +0100 |
| commit | 38bf550470f5c72fec0386942b03d48f1b133853 (patch) | |
| tree | 92f019ca69dac5b9bf2b67887f8def4c1915f18f | |
| parent | Add support for operations from foreign threads (diff) | |
| download | guile-fibers-38bf550470f5c72fec0386942b03d48f1b133853.tar.gz | |
Allow run-fibers thread to be cleanly cancelled
* fibers.scm (run-fibers): Spawn and cancel aux threads within a
dynamic-wind.
| -rw-r--r-- | fibers.scm | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -92,9 +92,10 @@ (call-with-values init (lambda vals (atomic-box-set! ret vals)))) scheduler) - (start-auxiliary-threads scheduler hz finished?) - (%run-fibers scheduler hz finished?) - (stop-auxiliary-threads scheduler) + (dynamic-wind + (lambda () (start-auxiliary-threads scheduler hz finished?)) + (lambda () (%run-fibers scheduler hz finished?)) + (lambda () (stop-auxiliary-threads scheduler))) (destroy-scheduler scheduler) (apply values (atomic-box-ref ret)))))) |
