提交 c337fd54 编写于 作者: B Brian Anderson

Child tasks take a ref to their parents

This is so that when a child dies after the parent, it still holds a valid
pointer and can call supervisor->kill() safely.
上级 25ae3d65
......@@ -86,6 +86,9 @@ rust_task::rust_task(rust_scheduler *sched, rust_task_list *state,
stk = new_stk(sched, this, 0);
user.rust_sp = stk->limit;
if (supervisor) {
supervisor->ref();
}
}
rust_task::~rust_task()
......@@ -107,6 +110,10 @@ rust_task::~rust_task()
}
}
if (supervisor) {
supervisor->deref();
}
kernel->release_task_id(user.id);
/* FIXME: tighten this up, there are some more
......@@ -294,6 +301,9 @@ rust_task::unsupervise()
"task %s @0x%" PRIxPTR
" disconnecting from supervisor %s @0x%" PRIxPTR,
name, this, supervisor->name, supervisor);
if (supervisor) {
supervisor->deref();
}
supervisor = NULL;
propagate_failure = false;
}
......
// Currently failure doesn't propagate correctly to owning tasks so xfailed
// xfail-test
// error-pattern:explicit
use std;
import std::task;
// We don't want to see any invalid reads
fn main() {
fn f() {
fail;
}
let g = f;
task::spawn(g);
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册