about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-01-21 12:33:36 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-01-21 12:33:36 -0800
commitdf0485ae6ebe851e081cf1b7263a47d67a0cf67e (patch)
tree29a2a90a24d6435afea581ed81c576da96daa701
parente612b44f76e6ab450d82bd34b584053052bd44af (diff)
downloadmu-df0485ae6ebe851e081cf1b7263a47d67a0cf67e.tar.gz
598 - clear up a minor mystery
-rw-r--r--chessboard-cursor.arc.t5
-rw-r--r--mu.arc9
-rw-r--r--mu.arc.t1
3 files changed, 11 insertions, 4 deletions
diff --git a/chessboard-cursor.arc.t b/chessboard-cursor.arc.t
index b5eac1e7..408be3d0 100644
--- a/chessboard-cursor.arc.t
+++ b/chessboard-cursor.arc.t
@@ -45,6 +45,7 @@
 (new-trace "read-move-incomplete")
 (add-code:readfile "chessboard-cursor.mu")
 ; initialize some variables at specific raw locations
+;? (prn "== init")
 (run-code test-init
   (1:channel-address/raw <- init-channel 1:literal)
   (2:terminal-address/raw <- init-fake-terminal 20:literal 10:literal)
@@ -52,6 +53,7 @@
 (wipe completed-routines*)
 ; the component under test; we'll be running this repeatedly
 (let read-move-routine (make-routine 'read-move memory*.1 memory*.2)
+;?   (prn "== first key")
   (run-code send-first-key
     (default-space:space-address <- new space:literal 30:literal/capacity)
     (c:character <- copy ((#\a literal)))
@@ -65,6 +67,7 @@
     (prn "F - chessboard waits after first letter of move"))
   (wipe completed-routines*)
   ; send in a few more letters
+;?   (prn "== more keys")
   (restart read-move-routine)
   (run-code send-more-keys
     (default-space:space-address <- new space:literal 30:literal/capacity)
@@ -82,7 +85,9 @@
     (prn "F - chessboard waits after each subsequent letter of move until the last"))
   (wipe completed-routines*)
   ; send final key
+;?   (prn "== final key")
   (restart read-move-routine)
+;?   (set dump-trace*)
   (run-code send-final-key
     (default-space:space-address <- new space:literal 30:literal/capacity)
     (c:character <- copy ((#\4 literal)))
diff --git a/mu.arc b/mu.arc
index e100d089..14ed973d 100644
--- a/mu.arc
+++ b/mu.arc
@@ -329,11 +329,8 @@
 ;   detect deadlock: kill all sleeping routines when none can be woken
 (def update-scheduler-state ()
   (when routine*
-;?     (prn routine*)
+;?     (prn "update scheduler state: " routine*)
     (if
-        empty.routine*
-          (do (trace "schedule" "done with routine")
-              (push routine* completed-routines*))
         rep.routine*!sleep
           (do (trace "schedule" "pushing " top.routine*!fn-name " to sleep queue")
               ; keep the clock ticking at rep.routine*!running-since
@@ -342,6 +339,9 @@
           (do (trace "schedule" "done with dead routine " top.routine*!fn-name)
 ;?               (tr rep.routine*)
               (push routine* completed-routines*))
+        empty.routine*
+          (do (trace "schedule" "done with routine")
+              (push routine* completed-routines*))
         (no rep.routine*!limit)
           (do (trace "schedule" "scheduling " top.routine*!fn-name " for further processing")
               (enq routine* running-routines*))
@@ -1461,6 +1461,7 @@
   (while (in top.routine!fn-name 'read 'write)
     (pop-stack routine))
   (wipe rep.routine!sleep)
+  (wipe rep.routine!error)
   (enq routine running-routines*))
 
 (def dump (msg routine)
diff --git a/mu.arc.t b/mu.arc.t
index a617ec3a..f810c4b4 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -2972,6 +2972,7 @@
 ;     when it timed out
 ;     when it completed
 ;   running multiple routines in tandem
+;   sleeping routine without a stack? how is that possible?
 ; first example using these features: read-move-incomplete in chessboard-cursor.arc.t
 
 ; The scheduler needs to keep track of the call stack for each routine.