Permalink
Browse files

Change task().future_result's argument mode

  • Loading branch information...
1 parent ae6d84f commit 18ac4a8e6d8db5ac8902bef504e220e0cd372cd1 @bblum bblum committed Aug 7, 2012
View
@@ -271,7 +271,7 @@ impl task_builder for task_builder {
* # Failure
* Fails if a future_result was already set for this task.
*/
- fn future_result(blk: fn(-future::future<task_result>)) -> task_builder {
+ fn future_result(blk: fn(+future::future<task_result>)) -> task_builder {
// FIXME (#1087, #1857): Once linked failure and notification are
// handled in the library, I can imagine implementing this by just
// registering an arbitrary number of task::on_exit handlers and
@@ -394,7 +394,7 @@ impl task_builder for task_builder {
let ch = comm::chan(po);
let mut result = none;
- do self.future_result(|-r| { result = some(r); }).spawn {
+ do self.future_result(|+r| { result = some(r); }).spawn {
comm::send(ch, f());
}
match future::get(option::unwrap(result)) {
@@ -1684,19 +1684,19 @@ fn test_add_wrapper() {
#[ignore(cfg(windows))]
fn test_future_result() {
let mut result = none;
- do task().future_result(|-r| { result = some(r); }).spawn { }
+ do task().future_result(|+r| { result = some(r); }).spawn { }
assert future::get(option::unwrap(result)) == success;
result = none;
- do task().future_result(|-r| { result = some(r); }).unlinked().spawn {
+ do task().future_result(|+r| { result = some(r); }).unlinked().spawn {
fail;
}
assert future::get(option::unwrap(result)) == failure;
}
#[test] #[should_fail] #[ignore(cfg(windows))]
fn test_back_to_the_future_result() {
- let _ = task().future_result(|-r| ()).future_result(|-r| ());
+ let _ = task().future_result(util::ignore).future_result(util::ignore);
}
#[test]
View
@@ -390,7 +390,7 @@ fn run_test(+test: test_desc, monitor_ch: comm::chan<monitor_msg>) {
do task::spawn {
let testfn = copy test.fn;
let mut result_future = none; // task::future_result(builder);
- task::task().unlinked().future_result(|-r| {
+ task::task().unlinked().future_result(|+r| {
result_future = some(r);
}).spawn(testfn);
let task_result = future::get(option::unwrap(result_future));
@@ -58,7 +58,7 @@ fn run(args: &[~str]) {
let mut worker_results = ~[];
for uint::range(0u, workers) |i| {
let to_child = to_child.clone();
- do task::task().future_result(|-r| {
+ do task::task().future_result(|+r| {
vec::push(worker_results, r);
}).spawn {
for uint::range(0u, size / workers) |_i| {
@@ -54,7 +54,7 @@ fn run(args: &[~str]) {
for uint::range(0u, workers) |i| {
let (to_child, from_parent_) = pipes::stream();
from_parent.add(from_parent_);
- do task::task().future_result(|-r| {
+ do task::task().future_result(|+r| {
vec::push(worker_results, r);
}).spawn {
for uint::range(0u, size / workers) |_i| {
@@ -39,7 +39,7 @@ fn run(args: ~[~str]) {
let to_child = to_child;
let mut worker_results = ~[];
for uint::range(0u, workers) |_i| {
- do task::task().future_result(|-r| {
+ do task::task().future_result(|+r| {
vec::push(worker_results, r);
}).spawn {
for uint::range(0u, size / workers) |_i| {
@@ -70,7 +70,7 @@ fn stress_task(&&id: int) {
fn stress(num_tasks: int) {
let mut results = ~[];
for range(0, num_tasks) |i| {
- do task::task().future_result(|-r| {
+ do task::task().future_result(|+r| {
results += ~[r];
}).spawn {
stress_task(i);
@@ -31,7 +31,7 @@ fn grandchild_group(num_tasks: uint) {
fn spawn_supervised_blocking(myname: &str, +f: fn~()) {
let mut res = none;
- task::task().future_result(|-r| res = some(r)).supervised().spawn(f);
+ task::task().future_result(|+r| res = some(r)).supervised().spawn(f);
#error["%s group waiting", myname];
let x = future::get(option::unwrap(res));
assert x == task::success;
@@ -8,7 +8,7 @@ fn start(&&task_number: int) { debug!{"Started / Finished task."}; }
fn test00() {
let i: int = 0;
let mut result = none;
- do task::task().future_result(|-r| { result = some(r); }).spawn {
+ do task::task().future_result(|+r| { result = some(r); }).spawn {
start(i)
}
@@ -32,7 +32,7 @@ fn test00() {
let mut results = ~[];
while i < number_of_tasks {
let ch = po.chan();
- do task::task().future_result(|-r| {
+ do task::task().future_result(|+r| {
results += ~[r];
}).spawn |copy i| {
test00_start(ch, i, number_of_messages)
@@ -16,7 +16,7 @@ fn test00() {
let ch = p.chan();
let mut result = none;
- do task::task().future_result(|-r| { result = some(r); }).spawn {
+ do task::task().future_result(|+r| { result = some(r); }).spawn {
test00_start(ch, number_of_messages);
}
@@ -41,7 +41,7 @@ fn test00() {
let mut results = ~[];
while i < number_of_tasks {
i = i + 1;
- do task::task().future_result(|-r| {
+ do task::task().future_result(|+r| {
results += ~[r];
}).spawn |copy i| {
test00_start(ch, i, number_of_messages);
@@ -128,7 +128,7 @@ fn test06() {
let mut results = ~[];
while i < number_of_tasks {
i = i + 1;
- do task::task().future_result(|-r| {
+ do task::task().future_result(|+r| {
results += ~[r];
}).spawn |copy i| {
test06_start(i);
@@ -5,7 +5,7 @@ import task::*;
fn main() {
let mut result = none;
- task::task().future_result(|-r| { result = some(r); }).spawn(child);
+ task::task().future_result(|+r| { result = some(r); }).spawn(child);
error!{"1"};
yield();
error!{"2"};
@@ -5,7 +5,7 @@ import task::*;
fn main() {
let mut result = none;
- task::task().future_result(|-r| { result = some(r); }).spawn(child);
+ task::task().future_result(|+r| { result = some(r); }).spawn(child);
error!{"1"};
yield();
future::get(option::unwrap(result));

0 comments on commit 18ac4a8

Please sign in to comment.