Skip to content

Commit 2539495

Browse files
committed
Handle the case where a child task tries to kill a parent while it is dying
Still looks pretty racy
1 parent ad470d7 commit 2539495

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/rt/rust_task.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ rust_task::yield(size_t time_in_us) {
254254
LOG(this, task, "task %s @0x%" PRIxPTR " yielding for %d us",
255255
name, this, time_in_us);
256256

257-
if (killed) {
257+
if (killed && !dead()) {
258258
if (blocked()) {
259259
unblock();
260260
}

src/test/run-pass/lots-a-fail.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// FIXME: Importing std::task doesn't work under check-fast?!
2+
// xfail-fast
3+
use std;
4+
import std::task;
5+
import std::comm;
6+
import std::uint;
7+
8+
fn die() {
9+
fail;
10+
}
11+
12+
fn iloop() {
13+
task::unsupervise();
14+
let f = die;
15+
task::spawn(f);
16+
}
17+
18+
fn main() {
19+
for each i in uint::range(0u, 100u) {
20+
let f = iloop;
21+
task::spawn(f);
22+
}
23+
}

0 commit comments

Comments
 (0)