about summary refs log tree commit diff
path: root/src/libstd/task/spawn.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-12-05 18:19:06 -0800
committerAlex Crichton <alex@alexcrichton.com>2013-12-16 17:47:11 -0800
commit529e268ab900f1b6e731af64ce2aeecda3555f4e (patch)
tree7ebb9ed2a7f36455b9550749a442522d45f0dc30 /src/libstd/task/spawn.rs
parentbfa9064ba2687eb1d95708f72f41ddd9729a6ba1 (diff)
downloadrust-529e268ab900f1b6e731af64ce2aeecda3555f4e.tar.gz
rust-529e268ab900f1b6e731af64ce2aeecda3555f4e.zip
Fallout of rewriting std::comm
Diffstat (limited to 'src/libstd/task/spawn.rs')
-rw-r--r--src/libstd/task/spawn.rs21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs
index 4ab7b74d300..eb3e19f4a5a 100644
--- a/src/libstd/task/spawn.rs
+++ b/src/libstd/task/spawn.rs
@@ -77,18 +77,15 @@
 
 use prelude::*;
 
-use comm::{GenericChan, oneshot};
+use comm::Chan;
 use rt::local::Local;
 use rt::sched::{Scheduler, Shutdown, TaskFromFriend};
 use rt::task::{Task, Sched};
-use rt::task::UnwindResult;
 use rt::thread::Thread;
 use rt::{in_green_task_context, new_event_loop};
-use task::SingleThreaded;
-use task::TaskOpts;
+use task::{SingleThreaded, TaskOpts, TaskResult};
 
 #[cfg(test)] use task::default_task_opts;
-#[cfg(test)] use comm;
 #[cfg(test)] use task;
 
 pub fn spawn_raw(mut opts: TaskOpts, f: proc()) {
@@ -132,7 +129,7 @@ pub fn spawn_raw(mut opts: TaskOpts, f: proc()) {
 
             // Create a task that will later be used to join with the new scheduler
             // thread when it is ready to terminate
-            let (thread_port, thread_chan) = oneshot();
+            let (thread_port, thread_chan) = Chan::new();
             let join_task = do Task::build_child(None) {
                 debug!("running join task");
                 let thread: Thread<()> = thread_port.recv();
@@ -173,7 +170,7 @@ pub fn spawn_raw(mut opts: TaskOpts, f: proc()) {
 
     if opts.notify_chan.is_some() {
         let notify_chan = opts.notify_chan.take_unwrap();
-        let on_exit: proc(UnwindResult) = proc(task_result) {
+        let on_exit: proc(TaskResult) = proc(task_result) {
             notify_chan.send(task_result)
         };
         task.death.on_exit = Some(on_exit);
@@ -187,7 +184,7 @@ pub fn spawn_raw(mut opts: TaskOpts, f: proc()) {
 
 #[test]
 fn test_spawn_raw_simple() {
-    let (po, ch) = stream();
+    let (po, ch) = Chan::new();
     do spawn_raw(default_task_opts()) {
         ch.send(());
     }
@@ -208,7 +205,7 @@ fn test_spawn_raw_unsupervise() {
 
 #[test]
 fn test_spawn_raw_notify_success() {
-    let (notify_po, notify_ch) = comm::stream();
+    let (notify_po, notify_ch) = Chan::new();
 
     let opts = task::TaskOpts {
         notify_chan: Some(notify_ch),
@@ -216,13 +213,13 @@ fn test_spawn_raw_notify_success() {
     };
     do spawn_raw(opts) {
     }
-    assert!(notify_po.recv().is_success());
+    assert!(notify_po.recv().is_ok());
 }
 
 #[test]
 fn test_spawn_raw_notify_failure() {
     // New bindings for these
-    let (notify_po, notify_ch) = comm::stream();
+    let (notify_po, notify_ch) = Chan::new();
 
     let opts = task::TaskOpts {
         watched: false,
@@ -232,5 +229,5 @@ fn test_spawn_raw_notify_failure() {
     do spawn_raw(opts) {
         fail!();
     }
-    assert!(notify_po.recv().is_failure());
+    assert!(notify_po.recv().is_err());
 }