Unsupervise tasks before the scheduler kills them. Unblock before yield->fail

This commit is contained in:
Brian Anderson 2011-09-14 17:05:35 -07:00
parent 69eda46af8
commit a0ad9a42cd
3 changed files with 9 additions and 3 deletions

View File

@ -81,10 +81,14 @@ rust_scheduler::kill_all_tasks() {
scoped_lock with(lock);
for (size_t i = 0; i < running_tasks.length(); i++) {
// We don't want the failure of these tasks to propagate back
// to the kernel again since we're already failing everything
running_tasks[i]->unsupervise();
running_tasks[i]->kill();
}
for (size_t i = 0; i < blocked_tasks.length(); i++) {
blocked_tasks[i]->unsupervise();
blocked_tasks[i]->kill();
}
}

View File

@ -255,6 +255,9 @@ rust_task::yield(size_t time_in_us) {
name, this, time_in_us);
if (killed) {
if (blocked()) {
unblock();
}
killed = false;
fail();
}

View File

@ -1,5 +1,4 @@
// -*- rust -*-
// xfail-test
// error-pattern:1 == 2
use std;
import std::task;
@ -24,8 +23,8 @@ fn sleeper() {
}
fn main() {
let f = parent;
let g = sleeper;
task::spawn(f);
task::spawn(g);
let f = parent;
task::spawn(f);
}