Handle the case where a child task tries to kill a parent while it is dying

Still looks pretty racy
This commit is contained in:
Brian Anderson 2011-09-16 09:30:20 -07:00
parent ad470d741e
commit 25394950ae
2 changed files with 24 additions and 1 deletions

View File

@ -254,7 +254,7 @@ rust_task::yield(size_t time_in_us) {
LOG(this, task, "task %s @0x%" PRIxPTR " yielding for %d us",
name, this, time_in_us);
if (killed) {
if (killed && !dead()) {
if (blocked()) {
unblock();
}

View File

@ -0,0 +1,23 @@
// FIXME: Importing std::task doesn't work under check-fast?!
// xfail-fast
use std;
import std::task;
import std::comm;
import std::uint;
fn die() {
fail;
}
fn iloop() {
task::unsupervise();
let f = die;
task::spawn(f);
}
fn main() {
for each i in uint::range(0u, 100u) {
let f = iloop;
task::spawn(f);
}
}