about summary refs log tree commit diff stats
path: root/073wait.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-09-15 00:49:58 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-09-15 00:53:27 -0700
commit36b927a63cb25e9fc64cf4ae079b32d23d528b1b (patch)
treedeafd2386dbac6e1e2233dff6007532e8af77459 /073wait.cc
parent05fe4be58a11eb83373d66069cbd64f75846a4ed (diff)
downloadmu-36b927a63cb25e9fc64cf4ae079b32d23d528b1b.tar.gz
3354 - support multiple routines at a source/sink
This commit completes the final step: fixing the final failing tests (in
chessboard.mu) by teaching `restart` about the block signal.
Diffstat (limited to '073wait.cc')
-rw-r--r--073wait.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/073wait.cc b/073wait.cc
index 8db03834..a762a8b7 100644
--- a/073wait.cc
+++ b/073wait.cc
@@ -551,6 +551,7 @@ case RESTART: {
     if (Routines.at(i)->id == id) {
       if (Routines.at(i)->state == WAITING)
         Routines.at(i)->state = RUNNING;
+      Routines.at(i)->blocked = false;
       break;
     }
   }
@@ -571,3 +572,29 @@ def f [
   1:number/raw <- copy 1
 ]
 # shouldn't crash
+
+:(scenario restart_blocked_routine)
+% Scheduling_interval = 1;
+def main [
+  local-scope
+  r:number/routine-id <- start-running f
+  wait-for-routine-to-block r  # get past the block in f below
+  restart r
+  wait-for-routine-to-block r  # should run f to completion
+]
+# function with one block
+def f [
+  current-routine-is-blocked
+  # 8 instructions of padding, many more than 'main' above
+  1:number <- add 1:number, 1
+  1:number <- add 1:number, 1
+  1:number <- add 1:number, 1
+  1:number <- add 1:number, 1
+  1:number <- add 1:number, 1
+  1:number <- add 1:number, 1
+  1:number <- add 1:number, 1
+  1:number <- add 1:number, 1
+  1:number <- add 1:number, 1
+]
+# make sure all of f ran
++mem: storing 8 in location 1