Get rid of task::future_task
This commit is contained in:
@@ -45,7 +45,6 @@ export add_wrapper;
|
|||||||
export run;
|
export run;
|
||||||
|
|
||||||
export future_result;
|
export future_result;
|
||||||
export future_task;
|
|
||||||
export unsupervise;
|
export unsupervise;
|
||||||
export run_listener;
|
export run_listener;
|
||||||
export run_with;
|
export run_with;
|
||||||
@@ -464,30 +463,6 @@ fn future_result(builder: builder) -> future::future<task_result> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn future_task(builder: builder) -> future::future<task> {
|
|
||||||
//! Get a future representing the handle to the new task
|
|
||||||
|
|
||||||
import future::future_pipe;
|
|
||||||
|
|
||||||
let (po, ch) = future_pipe::init();
|
|
||||||
|
|
||||||
let ch = ~mut some(ch);
|
|
||||||
|
|
||||||
do add_wrapper(builder) |body, move ch| {
|
|
||||||
let ch = { let mut t = none;
|
|
||||||
t <-> *ch;
|
|
||||||
~mut t};
|
|
||||||
fn~(move ch) {
|
|
||||||
let mut po = none;
|
|
||||||
po <-> *ch;
|
|
||||||
future_pipe::server::completed(option::unwrap(po),
|
|
||||||
get_task());
|
|
||||||
body();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
future::from_port(po)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn unsupervise(builder: builder) {
|
fn unsupervise(builder: builder) {
|
||||||
//! Configures the new task to not propagate failure to its parent
|
//! Configures the new task to not propagate failure to its parent
|
||||||
|
|
||||||
@@ -1476,16 +1451,6 @@ fn test_future_result() {
|
|||||||
assert future::get(option::unwrap(result)) == failure;
|
assert future::get(option::unwrap(result)) == failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_future_task() {
|
|
||||||
let po = comm::port();
|
|
||||||
let ch = comm::chan(po);
|
|
||||||
let buildr = builder();
|
|
||||||
let task1 = future_task(buildr);
|
|
||||||
do run(buildr) { comm::send(ch, get_task()) }
|
|
||||||
assert future::get(task1) == comm::recv(po);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_spawn_listiner_bidi() {
|
fn test_spawn_listiner_bidi() {
|
||||||
let po = comm::port();
|
let po = comm::port();
|
||||||
@@ -1700,17 +1665,6 @@ fn test_avoid_copying_the_body_try() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_avoid_copying_the_body_future_task() {
|
|
||||||
do avoid_copying_the_body |f| {
|
|
||||||
let buildr = builder();
|
|
||||||
future_task(buildr);
|
|
||||||
do run(buildr) {
|
|
||||||
f();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_avoid_copying_the_body_unlinked() {
|
fn test_avoid_copying_the_body_unlinked() {
|
||||||
do avoid_copying_the_body |f| {
|
do avoid_copying_the_body |f| {
|
||||||
|
|||||||
Reference in New Issue
Block a user