diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2014-11-21 15:07:33 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2014-11-21 15:07:33 -0800 |
commit | 913c4b5f15b9ded3e26a05320e1874a4ecaadec5 (patch) | |
tree | c40b41bdfc8530c92c7708a48bb538344a064a0f /mu.arc.t | |
parent | a384ea314c14bab2c1043a2e5f07a6ebb9052f70 (diff) | |
download | mu-913c4b5f15b9ded3e26a05320e1874a4ecaadec5.tar.gz |
280 - waking up sleeping routines
Tests still hanging at some point.
Diffstat (limited to 'mu.arc.t')
-rw-r--r-- | mu.arc.t | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/mu.arc.t b/mu.arc.t index 6d4536e3..d023d2f9 100644 --- a/mu.arc.t +++ b/mu.arc.t @@ -1721,6 +1721,46 @@ )) (reset) +(new-trace "scheduler-sleep") +(add-fns + '((f1 + ((1 integer) <- copy (3 literal))) + (f2 + ((2 integer) <- copy (4 literal))))) +; 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 +(let routine make-routine!f2 + (= rep.routine!sleep '(literal 23)) + (set sleeping-routines*.routine)) +; not yet time for it to wake up +(= curr-cycle* 23) +(update-scheduler-state) +(if (~is 1 len.running-routines*) + (prn "F - scheduler lets routines sleep")) + +(reset) +(new-trace "scheduler-wakeup") +(add-fns + '((f1 + ((1 integer) <- copy (3 literal))) + (f2 + ((2 integer) <- copy (4 literal))))) +; 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 +(let routine make-routine!f2 + (= rep.routine!sleep '(literal 23)) + (set sleeping-routines*.routine)) +; time for it to wake up +(= curr-cycle* 24) +(update-scheduler-state) +(if (~is 2 len.running-routines*) + (prn "F - scheduler wakes up sleeping routines at the right time")) + +(reset) (new-trace "sleep") (add-fns '((f1 |