summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/scripting.scm11
1 files changed, 7 insertions, 4 deletions
diff --git a/chickadee/scripting.scm b/chickadee/scripting.scm
index d4a2b81..0e29fa6 100644
--- a/chickadee/scripting.scm
+++ b/chickadee/scripting.scm
@@ -22,8 +22,9 @@
#:use-module (chickadee scripting channel)
#:use-module (chickadee scripting coroutine)
#:export (forever
- wait
- tween))
+ sleep
+ tween)
+ #:replace (sleep))
;; Export public bindings from other modules.
(eval-when (eval load compile)
@@ -40,8 +41,10 @@
"Evaluate BODY in an endless loop."
(while #t body ...))
-(define (wait duration)
+(define (sleep duration)
"Wait DURATION before resuming the current coroutine."
+ ;; Capture the current agenda before suspending the coroutine so
+ ;; that we schedule the continuation in the right place.
(let ((agenda (current-agenda)))
(yield
(lambda (cont)
@@ -66,5 +69,5 @@ END. By default, linear interpolation is used."
(proc end)
(let ((alpha (ease (/ t duration))))
(proc (interpolate start end alpha))
- (wait step)
+ (sleep step)
(loop (+ t step))))))