Skip to content

Commit 01a52d7

Browse files
committed
Add an unsupervise builtin and function to std::task
Calling task::unsupervise de-parents the current task, with the result that failures do not propogate up the task tree.
1 parent 4738cf8 commit 01a52d7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/lib/task.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ native "rust" mod rustrt {
22
fn task_sleep(uint time_in_us);
33
fn task_yield();
44
fn task_join(task t);
5+
fn task_unsupervise();
56
fn pin_task();
67
fn unpin_task();
78
}
@@ -23,6 +24,10 @@ fn join(task t) {
2324
ret rustrt::task_join(t);
2425
}
2526

27+
fn unsupervise() {
28+
ret rustrt::task_unsupervise();
29+
}
30+
2631
fn pin() {
2732
rustrt::pin_task();
2833
}

src/rt/rust_builtin.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,11 @@ task_join(rust_task *task, rust_task *join_task) {
425425
}
426426
}
427427

428+
extern "C" CDECL void
429+
task_unsupervise(rust_task *task) {
430+
task->unsupervise();
431+
}
432+
428433
/* Debug builtins for std.dbg. */
429434

430435
static void

0 commit comments

Comments
 (0)