diff options
Diffstat (limited to 'chickadee/scripting/coroutine.scm')
-rw-r--r-- | chickadee/scripting/coroutine.scm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/chickadee/scripting/coroutine.scm b/chickadee/scripting/coroutine.scm index 38f0da0..642ff83 100644 --- a/chickadee/scripting/coroutine.scm +++ b/chickadee/scripting/coroutine.scm @@ -71,9 +71,11 @@ handler))) (when (procedure? callback) (apply callback resume args))) - (define (task) - (thunk) - (set-coroutine-status! co 'complete)) + (define task + (let ((dynamic-state (current-dynamic-state))) + (lambda () + (with-dynamic-state dynamic-state thunk) + (set-coroutine-status! co 'complete)))) ;; Start the coroutine. (call-with-prompt coroutine-prompt task handler) co)) |