about summary refs log tree commit diff stats
path: root/063wait.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-04-22 23:23:51 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-04-22 23:23:51 -0700
commit10294369b9624383f757e93903f3eec2debb3474 (patch)
tree003bf4026bd42251d6ba23fcbb7fc4cf70e54cf6 /063wait.cc
parentd31037ffdcdb8097b91af121a27ef18c15f7e802 (diff)
downloadmu-10294369b9624383f757e93903f3eec2debb3474.tar.gz
2855
Diffstat (limited to '063wait.cc')
-rw-r--r--063wait.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/063wait.cc b/063wait.cc
index 19bfb2d8..1adc9ad4 100644
--- a/063wait.cc
+++ b/063wait.cc
@@ -29,6 +29,27 @@ int old_value_of_waiting_location;
 :(before "End routine Constructor")
 waiting_on_location = old_value_of_waiting_location = 0;
 
+:(before "End Mu Test Teardown")
+if (Passed && any_routines_waiting()) {
+  Passed = false;
+  raise << Current_scenario->name << ": deadlock!\n" << end();
+  ++Num_failures;
+}
+:(before "End Test Teardown")
+if (Passed && any_routines_with_error()) {
+  Passed = false;
+  raise << "some routines died with errors\n" << end();
+  ++Num_failures;
+}
+:(code)
+bool any_routines_waiting() {
+  for (int i = 0; i < SIZE(Routines); ++i) {
+    if (Routines.at(i)->state == WAITING)
+      return true;
+  }
+  return false;
+}
+
 //: primitive recipe to put routines in that state
 
 :(before "End Primitive Recipe Declarations")