summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/scripting.scm6
-rw-r--r--chickadee/scripting/coroutine.scm8
2 files changed, 10 insertions, 4 deletions
diff --git a/chickadee/scripting.scm b/chickadee/scripting.scm
index 5d24ce9..d4a2b81 100644
--- a/chickadee/scripting.scm
+++ b/chickadee/scripting.scm
@@ -42,7 +42,11 @@
(define (wait duration)
"Wait DURATION before resuming the current coroutine."
- (yield (lambda (cont) (schedule-after duration cont))))
+ (let ((agenda (current-agenda)))
+ (yield
+ (lambda (cont)
+ (with-agenda agenda
+ (schedule-after duration cont))))))
(define* (tween duration start end proc #:key
(step 1)
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))