1
Fork 0

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); scoped_lock with(lock);
for (size_t i = 0; i < running_tasks.length(); i++) { 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(); running_tasks[i]->kill();
} }
for (size_t i = 0; i < blocked_tasks.length(); i++) { for (size_t i = 0; i < blocked_tasks.length(); i++) {
blocked_tasks[i]->unsupervise();
blocked_tasks[i]->kill(); blocked_tasks[i]->kill();
} }
} }

View file

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

View file

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