about summary refs log tree commit diff stats
path: root/mu.arc.t
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-11-06 19:12:56 -0800
committerKartik K. Agaram <vc@akkartik.com>2014-11-06 19:13:05 -0800
commit84224cadcde5feb627252db90a96b384d95cb019 (patch)
treea868bb9b888e6316e9d439e087caed24be0da7ca /mu.arc.t
parent9d4694088df87eae573bb9a9468fbe5d84f456fb (diff)
downloadmu-84224cadcde5feb627252db90a96b384d95cb019.tar.gz
241 - 'sleep' on a memory location
I thought we could be oblivious of channels, but that requires more work.
Diffstat (limited to 'mu.arc.t')
-rw-r--r--mu.arc.t19
1 files changed, 19 insertions, 0 deletions
diff --git a/mu.arc.t b/mu.arc.t
index 4050a6aa..9e6ea769 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -1722,6 +1722,25 @@
     ("run" "f1 2")
   ))
 
+(reset)
+(new-trace "sleep-location")
+(add-fns
+  '((f1
+      ; waits for memory location 1 to be set, before computing its successor
+      ((1 integer) <- copy (0 literal))
+      (sleep (1 integer))
+      ((2 integer) <- add (1 integer) (1 literal)))
+    (f2
+      (sleep (30 literal))
+      ((1 integer) <- copy (3 literal)))))  ; set to value
+;? (= dump-trace* (obj whitelist '("run" "schedule")))
+(= scheduling-interval* 1)
+(run 'f1 'f2)
+;? (prn canon.memory*)
+(if (~is memory*.2 4)  ; successor of value
+  (prn "F - scheduler handles routines blocking on a memory location"))
+;? (quit)
+
 ; The scheduler needs to keep track of the call stack for each routine.
 ; Eventually we'll want to save this information in mu's address space itself,
 ; along with the types array, the magic buffers for args and oargs, and so on.