Re-enabled join.
This commit is contained in:
parent
1fa9133b76
commit
c4f9bd9470
@ -1,6 +1,7 @@
|
||||
native "rust" mod rustrt {
|
||||
fn task_sleep(uint time_in_us);
|
||||
fn task_yield();
|
||||
fn task_join(task t);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -17,8 +18,7 @@ fn yield() {
|
||||
}
|
||||
|
||||
fn join(task t) {
|
||||
// TODO: figure out how to pass tasks to the runtime and call the builtin
|
||||
// join.
|
||||
ret rustrt::task_join(t);
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
|
@ -361,7 +361,12 @@ task_yield(rust_task *task) {
|
||||
|
||||
extern "C" CDECL void
|
||||
task_join(rust_task *task, rust_task *join_task) {
|
||||
// TODO
|
||||
// If the other task is already dying, we don't have to wait for it.
|
||||
if (join_task->dead() == false) {
|
||||
join_task->tasks_waiting_to_join.push(task);
|
||||
task->block(join_task, "joining local task");
|
||||
task->yield(2);
|
||||
}
|
||||
}
|
||||
|
||||
/* Debug builtins for std.dbg. */
|
||||
|
@ -509,8 +509,6 @@ upcall_new_task(rust_task *spawner, rust_vec *name) {
|
||||
return task;
|
||||
}
|
||||
|
||||
// TODO: This is copied from rust_task.cpp. Both copies should be moved to a
|
||||
// common location.
|
||||
static uintptr_t
|
||||
align_down(uintptr_t sp)
|
||||
{
|
||||
|
18
src/test/run-pass/join.rs
Normal file
18
src/test/run-pass/join.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// xfail-stage0
|
||||
// -*- rust -*-
|
||||
|
||||
use std;
|
||||
|
||||
import std::task::*;
|
||||
|
||||
fn main() {
|
||||
auto other = spawn child();
|
||||
log_err "1";
|
||||
yield();
|
||||
join(other);
|
||||
log_err "3";
|
||||
}
|
||||
|
||||
fn child() {
|
||||
log_err "2";
|
||||
}
|
Loading…
Reference in New Issue
Block a user