Skip to content

Commit 4738cf8

Browse files
committed
Move the responsibility for process failure from tasks to the scheduler
When the root task fails the process fails. Failures on other tasks propagate up the task tree. Failures on non-root tasks without parents just (theoretically) unwind and disappear.
1 parent 827e300 commit 4738cf8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/rt/rust_scheduler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ rust_scheduler::fail() {
7272
name, this);
7373
I(this, rval == 0);
7474
rval = 1;
75+
exit(1);
7576
}
7677

7778
size_t

src/rt/rust_task.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,6 @@ rust_task::fail() {
220220
backtrace();
221221
// Unblock the task so it can unwind.
222222
unblock();
223-
if (this == sched->root_task)
224-
sched->fail();
225223
if (supervisor) {
226224
DLOG(sched, task,
227225
"task %s @0x%" PRIxPTR
@@ -230,7 +228,8 @@ rust_task::fail() {
230228
supervisor->kill();
231229
}
232230
// FIXME: implement unwinding again.
233-
exit(1);
231+
if (this == sched->root_task)
232+
sched->fail();
234233
}
235234

236235
void

0 commit comments

Comments
 (0)