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-21 20:47:48 -0800
committerKartik K. Agaram <vc@akkartik.com>2014-11-21 20:47:48 -0800
commit4a007fd922d2a8dc1d67b1283a41f75e800e1cb4 (patch)
treee3c08670c0ae6e3c28338ded42b83b95bafa8ccc /mu.arc.t
parent672cda7e1ce754dda4801a7411221f5ed80517fb (diff)
downloadmu-4a007fd922d2a8dc1d67b1283a41f75e800e1cb4.tar.gz
289 - finally back to deadlock detection
Diffstat (limited to 'mu.arc.t')
-rw-r--r--mu.arc.t27
1 files changed, 24 insertions, 3 deletions
diff --git a/mu.arc.t b/mu.arc.t
index da0ffa0f..685e097e 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -1773,7 +1773,7 @@
 ; add one baseline routine to run (empty running-routines* handled below)
 (enq make-routine!f1 running-routines*)
 (assert (is 1 len.running-routines*))
-; sleeping routine
+; blocked routine
 (let routine make-routine!f2
   (= rep.routine!sleep '(23 integer))
   (set sleeping-routines*.routine))
@@ -1801,11 +1801,11 @@
 ; add one baseline routine to run (empty running-routines* handled below)
 (enq make-routine!f1 running-routines*)
 (assert (is 1 len.running-routines*))
-; sleeping routine
+; blocked routine
 (let routine make-routine!f2
   (= rep.routine!sleep '(23 integer))
   (set sleeping-routines*.routine))
-; set memory location
+; set memory location and unblock routine
 (= memory*.23 1)
 (update-scheduler-state)
 (if (~is 2 len.running-routines*)
@@ -1830,6 +1830,27 @@
   (prn "F - scheduler skips ahead to earliest sleeping routines when nothing to run"))
 
 (reset)
+(new-trace "scheduler-deadlock")
+(add-fns
+  '((f1
+      ((1 integer) <- copy (3 literal)))))
+(assert (empty running-routines*))
+(assert (empty completed-routines*))
+; blocked routine
+(let routine make-routine!f1
+  (= rep.routine!sleep '(23 integer))
+  (set sleeping-routines*.routine))
+; location it's waiting on is 'empty'
+(= memory*.23 0)
+(update-scheduler-state)
+(assert (~empty completed-routines*))
+;? (prn completed-routines*)
+(let routine completed-routines*.0
+  (when (~posmatch "deadlock" rep.routine!error)
+    (prn "F - scheduler detects deadlock")))
+;? (quit)
+
+(reset)
 (new-trace "sleep")
 (add-fns
   '((f1