about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-10-29 13:10:40 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-10-29 13:10:40 -0700
commit0f1fc1c0f033b8e39093297be98f668bfd376d9c (patch)
treee51d9bba74fc1249d0e827b2cc476e98fb18a94c
parent837355869864cdb0f13eea629275f59e44a855a0 (diff)
downloadmu-0f1fc1c0f033b8e39093297be98f668bfd376d9c.tar.gz
172 - save completed routines for better white-box testing
-rw-r--r--mu.arc14
1 files changed, 8 insertions, 6 deletions
diff --git a/mu.arc b/mu.arc
index 66dddc82..366895bd 100644
--- a/mu.arc
+++ b/mu.arc
@@ -269,21 +269,23 @@
   (let (oargs _ _)  (parse-instr ((body routine 1) (pc routine 1)))
     oargs))
 
-(= routines* (queue))
+(= running-routines* (queue))
+(= completed-routines* (queue))
 (= routine* nil)
 
 (def run fn-names
   (ret result 0
     (each it fn-names
-      (enq make-routine.it routines*))
+      (enq make-routine.it running-routines*))
     ; simple round-robin scheduler
-    (while (~empty routines*)
-      (= routine* deq.routines*)
+    (while (~empty running-routines*)
+      (= routine* deq.running-routines*)
       (trace "schedule" top.routine*!fn-name)
       (let insts-run (run-for-time-slice scheduling-interval*)
         (= result (+ result insts-run)))
       (if (~empty routine*)
-        (enq routine* routines*)))))
+        (enq routine* running-routines*)
+        (enq-limit routine* completed-routines*)))))
 
 ($:require "charterm/main.rkt")
 
@@ -435,7 +437,7 @@
                 run
                   (run (v arg.0))
                 fork
-                  (enq (make-routine (v arg.0)) routines*)
+                  (enq (make-routine (v arg.0)) running-routines*)
                 ; todo: errors should stall a process and let its parent
                 ; inspect it
                 assert