about summary refs log tree commit diff stats
path: root/mu.arc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-01-10 13:49:16 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-01-10 13:49:16 -0800
commitea0d661bb77ca3a844ff7c7268cd5a9b3266265c (patch)
treed68c3c67405e3125f5284cc5a4d958ced7a358bd /mu.arc
parent9c2ed239561c069beba0953616ddab15ac21265b (diff)
downloadmu-ea0d661bb77ca3a844ff7c7268cd5a9b3266265c.tar.gz
529 - 'sleep' can now wait for a routine to complete
Diffstat (limited to 'mu.arc')
-rw-r--r--mu.arc5
1 files changed, 5 insertions, 0 deletions
diff --git a/mu.arc b/mu.arc
index dcbf5338..ac998383 100644
--- a/mu.arc
+++ b/mu.arc
@@ -250,6 +250,9 @@
       (> curr-cycle* rep.routine!sleep.1)
     until-location-changes
       (~is rep.routine!sleep.2 (memory* rep.routine!sleep.1))
+    until-routine-done
+      (find [and _ (is rep._!id rep.routine!sleep.1)]
+            completed-routines*)
     ))
 
 (on-init
@@ -587,6 +590,8 @@
                           (= rep.routine*!sleep `(until ,wakeup-time)))
                       until-location-changes
                         (= rep.routine*!sleep `(until-location-changes ,(addr arg.1) ,(m arg.1)))
+                      until-routine-done
+                        (= rep.routine*!sleep `(until-routine-done ,(m arg.1)))
                       ; else
                         (die "badly formed 'sleep' call @(tostring:prn (body.routine* pc.routine*))")
                       )