about summary refs log tree commit diff
path: root/src/rt/rust_task.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-09-14 15:26:59 -0700
committerBrian Anderson <banderson@mozilla.com>2011-09-14 15:48:14 -0700
commit103197bc422b6f1ae9958cc5c6a928d94d3e3366 (patch)
treec675af1a67f0f34ada01f5f4c522e4f74ff43240 /src/rt/rust_task.cpp
parent6dcd0a9b5e8b45262e3225ddff62d0a1098006ca (diff)
downloadrust-103197bc422b6f1ae9958cc5c6a928d94d3e3366.tar.gz
rust-103197bc422b6f1ae9958cc5c6a928d94d3e3366.zip
Make failure propagation to dead parents work
The failure will basically go 'through' the dead parent and continue
propagating the failure (as if the child was reparented).
Diffstat (limited to 'src/rt/rust_task.cpp')
-rw-r--r--src/rt/rust_task.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp
index e99ccc1d04b..bb31e4340a5 100644
--- a/src/rt/rust_task.cpp
+++ b/src/rt/rust_task.cpp
@@ -273,6 +273,7 @@ void
 rust_task::kill() {
     if (dead()) {
         // Task is already dead, can't kill what's already dead.
+        fail_parent();
         return;
     }
 
@@ -308,6 +309,14 @@ rust_task::conclude_failure() {
     die();
     // Unblock the task so it can unwind.
     unblock();
+    fail_parent();
+    failed = true;
+    notify_tasks_waiting_to_join();
+    yield(4);
+}
+
+void
+rust_task::fail_parent() {
     if (supervisor) {
         DLOG(sched, task,
              "task %s @0x%" PRIxPTR
@@ -318,9 +327,6 @@ rust_task::conclude_failure() {
     // FIXME: implement unwinding again.
     if (NULL == supervisor && propagate_failure)
         sched->fail();
-    failed = true;
-    notify_tasks_waiting_to_join();
-    yield(4);
 }
 
 void