about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-10-22 19:01:37 -0700
committerBrian Anderson <banderson@mozilla.com>2012-10-23 14:21:15 -0700
commit3e4b2bd2b2f48c98dab73c67b0ddf25a80129a3c (patch)
tree8a6dad33637190806df8065d73e3b00181541bff
parentf6d2a7143629898aebea58db836eb2009e97d067 (diff)
downloadrust-3e4b2bd2b2f48c98dab73c67b0ddf25a80129a3c.tar.gz
rust-3e4b2bd2b2f48c98dab73c67b0ddf25a80129a3c.zip
core: Use PortOne instead of Future in future_result
-rw-r--r--src/libcore/private.rs4
-rw-r--r--src/libcore/task.rs12
-rw-r--r--src/libstd/arc.rs2
-rw-r--r--src/libstd/test.rs2
-rw-r--r--src/test/bench/msgsend-pipes-shared.rs2
-rw-r--r--src/test/bench/msgsend-pipes.rs2
-rw-r--r--src/test/bench/msgsend.rs2
-rw-r--r--src/test/bench/shootout-pfib.rs2
-rw-r--r--src/test/bench/task-perf-linked-failure.rs2
-rw-r--r--src/test/run-pass/task-comm-12.rs2
-rw-r--r--src/test/run-pass/task-comm-3.rs2
-rw-r--r--src/test/run-pass/task-comm-9.rs2
-rw-r--r--src/test/run-pass/task-comm.rs4
-rw-r--r--src/test/run-pass/yield.rs2
-rw-r--r--src/test/run-pass/yield1.rs2
15 files changed, 21 insertions, 23 deletions
diff --git a/src/libcore/private.rs b/src/libcore/private.rs
index c4298d572b6..e7e9de39ccd 100644
--- a/src/libcore/private.rs
+++ b/src/libcore/private.rs
@@ -642,7 +642,7 @@ pub mod tests {
         // Have to get rid of our reference before blocking.
         { let _x = move x; } // FIXME(#3161) util::ignore doesn't work here
         let res = option::swap_unwrap(&mut res);
-        future::get(&res);
+        res.recv();
     }
 
     #[test] #[should_fail] #[ignore(cfg(windows))]
@@ -657,7 +657,7 @@ pub mod tests {
         }
         assert unwrap_exclusive(move x) == ~~"hello";
         let res = option::swap_unwrap(&mut res);
-        future::get(&res);
+        res.recv();
     }
 
     #[test] #[ignore(cfg(windows))]
diff --git a/src/libcore/task.rs b/src/libcore/task.rs
index 3bfa41f1c48..9a1d8cf39a8 100644
--- a/src/libcore/task.rs
+++ b/src/libcore/task.rs
@@ -314,7 +314,7 @@ impl TaskBuilder {
      * # Failure
      * Fails if a future_result was already set for this task.
      */
-    fn future_result(blk: fn(v: future::Future<TaskResult>)) -> TaskBuilder {
+    fn future_result(blk: fn(v: Port<TaskResult>)) -> TaskBuilder {
         // FIXME (#3725): 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
@@ -327,9 +327,7 @@ impl TaskBuilder {
         // Construct the future and give it to the caller.
         let (notify_pipe_ch, notify_pipe_po) = stream::<TaskResult>();
 
-        blk(do future::from_fn |move notify_pipe_po| {
-            notify_pipe_po.recv()
-        });
+        blk(move notify_pipe_po);
 
         // Reconfigure self to use a notify channel.
         TaskBuilder({
@@ -482,7 +480,7 @@ impl TaskBuilder {
         do fr_task_builder.spawn |move f| {
             comm::send(ch, f());
         }
-        match future::get(&option::unwrap(move result)) {
+        match option::unwrap(move result).recv() {
             Success => result::Ok(comm::recv(po)),
             Failure => result::Err(())
         }
@@ -899,14 +897,14 @@ fn test_add_wrapper() {
 fn test_future_result() {
     let mut result = None;
     do task().future_result(|+r| { result = Some(move r); }).spawn { }
-    assert future::get(&option::unwrap(move result)) == Success;
+    assert option::unwrap(move result).recv() == Success;
 
     result = None;
     do task().future_result(|+r|
         { result = Some(move r); }).unlinked().spawn {
         fail;
     }
-    assert future::get(&option::unwrap(move result)) == Failure;
+    assert option::unwrap(move result).recv() == Failure;
 }
 
 #[test] #[should_fail] #[ignore(cfg(windows))]
diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs
index 2f4c9a4eb06..0033a4eaccd 100644
--- a/src/libstd/arc.rs
+++ b/src/libstd/arc.rs
@@ -651,7 +651,7 @@ mod tests {
         }
 
         // Wait for children to pass their asserts
-        for vec::each(children) |r| { future::get(r); }
+        for vec::each(children) |r| { r.recv(); }
 
         // Wait for writer to finish
         p.recv();
diff --git a/src/libstd/test.rs b/src/libstd/test.rs
index ca83dbf17ed..b5fef604c58 100644
--- a/src/libstd/test.rs
+++ b/src/libstd/test.rs
@@ -391,7 +391,7 @@ fn run_test(test: TestDesc, monitor_ch: comm::Chan<MonitorMsg>) {
         task::task().unlinked().future_result(|+r| {
             result_future = Some(move r);
         }).spawn(move testfn);
-        let task_result = future::get(&option::unwrap(move result_future));
+        let task_result = option::unwrap(move result_future).recv();
         let test_result = calc_result(&test, task_result == task::Success);
         comm::send(monitor_ch, (copy test, test_result));
     };
diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs
index da891b376e3..55afa049091 100644
--- a/src/test/bench/msgsend-pipes-shared.rs
+++ b/src/test/bench/msgsend-pipes-shared.rs
@@ -74,7 +74,7 @@ fn run(args: &[~str]) {
     }
 
     for vec::each(worker_results) |r| {
-        future::get(r);
+        r.recv();
     }
 
     //error!("sending stop message");
diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs
index 041094adcd5..f0fc1dd5f00 100644
--- a/src/test/bench/msgsend-pipes.rs
+++ b/src/test/bench/msgsend-pipes.rs
@@ -71,7 +71,7 @@ fn run(args: &[~str]) {
     }
 
     for vec::each(worker_results) |r| {
-        future::get(r);
+        r.recv();
     }
 
     //error!("sending stop message");
diff --git a/src/test/bench/msgsend.rs b/src/test/bench/msgsend.rs
index 6ab22779c55..143d4d86d0d 100644
--- a/src/test/bench/msgsend.rs
+++ b/src/test/bench/msgsend.rs
@@ -45,7 +45,7 @@ fn run(args: ~[~str]) {
         };
     }
     for vec::each(worker_results) |r| {
-        future::get(r);
+        r.recv();
     }
     comm::send(to_child, stop);
     let result = comm::recv(from_child);
diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs
index a776c1322d3..e70b796298b 100644
--- a/src/test/bench/shootout-pfib.rs
+++ b/src/test/bench/shootout-pfib.rs
@@ -78,7 +78,7 @@ fn stress(num_tasks: int) {
             stress_task(i);
         }
     }
-    for results.each |r| { future::get(r); }
+    for results.each |r| { r.recv(); }
 }
 
 fn main() {
diff --git a/src/test/bench/task-perf-linked-failure.rs b/src/test/bench/task-perf-linked-failure.rs
index f148d595f9d..b0bc92797c9 100644
--- a/src/test/bench/task-perf-linked-failure.rs
+++ b/src/test/bench/task-perf-linked-failure.rs
@@ -33,7 +33,7 @@ fn spawn_supervised_blocking(myname: &str, +f: fn~()) {
     let mut res = None;
     task::task().future_result(|+r| res = Some(move r)).supervised().spawn(move f);
     error!("%s group waiting", myname);
-    let x = future::get(&option::unwrap(move res));
+    let x = option::unwrap(move res).recv();
     assert x == task::Success;
 }
 
diff --git a/src/test/run-pass/task-comm-12.rs b/src/test/run-pass/task-comm-12.rs
index 64ea3fb9d0e..59cbd26204e 100644
--- a/src/test/run-pass/task-comm-12.rs
+++ b/src/test/run-pass/task-comm-12.rs
@@ -19,7 +19,7 @@ fn test00() {
     }
 
     // Try joining tasks that have already finished.
-    future::get(&option::unwrap(move result));
+    option::unwrap(move result).recv();
 
     debug!("Joined task.");
 }
diff --git a/src/test/run-pass/task-comm-3.rs b/src/test/run-pass/task-comm-3.rs
index 7082cd55ac8..b34eff7c30b 100644
--- a/src/test/run-pass/task-comm-3.rs
+++ b/src/test/run-pass/task-comm-3.rs
@@ -53,7 +53,7 @@ fn test00() {
     }
 
     // Join spawned tasks...
-    for results.each |r| { future::get(r); }
+    for results.each |r| { r.recv(); }
 
     debug!("Completed: Final number is: ");
     log(error, sum);
diff --git a/src/test/run-pass/task-comm-9.rs b/src/test/run-pass/task-comm-9.rs
index 5ed5899658d..c8bd043a182 100644
--- a/src/test/run-pass/task-comm-9.rs
+++ b/src/test/run-pass/task-comm-9.rs
@@ -30,7 +30,7 @@ fn test00() {
         i += 1;
     }
 
-    future::get(&option::unwrap(move result));
+    option::unwrap(move result).recv();
 
     assert (sum == number_of_messages * (number_of_messages - 1) / 2);
 }
diff --git a/src/test/run-pass/task-comm.rs b/src/test/run-pass/task-comm.rs
index aba0bd66005..d1548de5a6d 100644
--- a/src/test/run-pass/task-comm.rs
+++ b/src/test/run-pass/task-comm.rs
@@ -51,7 +51,7 @@ fn test00() {
         while i < number_of_messages { sum += recv(po); i = i + 1; }
     }
 
-    for results.each |r| { future::get(r); }
+    for results.each |r| { r.recv(); }
 
     debug!("Completed: Final number is: ");
     assert (sum ==
@@ -134,7 +134,7 @@ fn test06() {
     }
 
 
-    for results.each |r| { future::get(r); }
+    for results.each |r| { r.recv(); }
 }
 
 
diff --git a/src/test/run-pass/yield.rs b/src/test/run-pass/yield.rs
index 11208a969db..0ef4d088f9c 100644
--- a/src/test/run-pass/yield.rs
+++ b/src/test/run-pass/yield.rs
@@ -10,7 +10,7 @@ fn main() {
     error!("2");
     yield();
     error!("3");
-    future::get(&option::unwrap(move result));
+    option::unwrap(move result).recv();
 }
 
 fn child() {
diff --git a/src/test/run-pass/yield1.rs b/src/test/run-pass/yield1.rs
index ec77a686324..0a6a7968224 100644
--- a/src/test/run-pass/yield1.rs
+++ b/src/test/run-pass/yield1.rs
@@ -7,7 +7,7 @@ fn main() {
     task::task().future_result(|+r| { result = Some(move r); }).spawn(child);
     error!("1");
     yield();
-    future::get(&option::unwrap(move result));
+    option::unwrap(move result).recv();
 }
 
 fn child() { error!("2"); }