about summary refs log tree commit diff
path: root/src/libnative/task.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-03-13 14:06:37 -0700
committerbors <bors@rust-lang.org>2014-03-13 14:06:37 -0700
commitb4d324334cb48198c27d782002d75eba14a6abde (patch)
tree950d8daa5e6305090bdd69625bb18ead48471865 /src/libnative/task.rs
parent6ff3c9995e63b63c16d13739a0fc2d321f95410e (diff)
parent78580651131c9daacd7e5e4669af819cdd719f09 (diff)
downloadrust-b4d324334cb48198c27d782002d75eba14a6abde.tar.gz
rust-b4d324334cb48198c27d782002d75eba14a6abde.zip
auto merge of #12815 : alexcrichton/rust/chan-rename, r=brson
* Chan<T> => Sender<T>
* Port<T> => Receiver<T>
* Chan::new() => channel()
* constructor returns (Sender, Receiver) instead of (Receiver, Sender)
* local variables named `port` renamed to `rx`
* local variables named `chan` renamed to `tx`

Closes #11765
Diffstat (limited to 'src/libnative/task.rs')
-rw-r--r--src/libnative/task.rs55
1 files changed, 27 insertions, 28 deletions
diff --git a/src/libnative/task.rs b/src/libnative/task.rs
index 793e4d48e13..8510b50777a 100644
--- a/src/libnative/task.rs
+++ b/src/libnative/task.rs
@@ -262,21 +262,21 @@ mod tests {
 
     #[test]
     fn smoke() {
-        let (p, c) = Chan::new();
+        let (tx, rx) = channel();
         spawn(proc() {
-            c.send(());
+            tx.send(());
         });
-        p.recv();
+        rx.recv();
     }
 
     #[test]
     fn smoke_fail() {
-        let (p, c) = Chan::<()>::new();
+        let (tx, rx) = channel::<()>();
         spawn(proc() {
-            let _c = c;
+            let _tx = tx;
             fail!()
         });
-        assert_eq!(p.recv_opt(), None);
+        assert_eq!(rx.recv_opt(), None);
     }
 
     #[test]
@@ -284,55 +284,54 @@ mod tests {
         let mut opts = TaskOpts::new();
         opts.name = Some("test".into_maybe_owned());
         opts.stack_size = Some(20 * 4096);
-        let (p, c) = Chan::new();
-        opts.notify_chan = Some(c);
+        let (tx, rx) = channel();
+        opts.notify_chan = Some(tx);
         spawn_opts(opts, proc() {});
-        assert!(p.recv().is_ok());
+        assert!(rx.recv().is_ok());
     }
 
     #[test]
     fn smoke_opts_fail() {
         let mut opts = TaskOpts::new();
-        let (p, c) = Chan::new();
-        opts.notify_chan = Some(c);
+        let (tx, rx) = channel();
+        opts.notify_chan = Some(tx);
         spawn_opts(opts, proc() { fail!() });
-        assert!(p.recv().is_err());
+        assert!(rx.recv().is_err());
     }
 
     #[test]
     fn yield_test() {
-        let (p, c) = Chan::new();
+        let (tx, rx) = channel();
         spawn(proc() {
             for _ in range(0, 10) { task::deschedule(); }
-            c.send(());
+            tx.send(());
         });
-        p.recv();
+        rx.recv();
     }
 
     #[test]
     fn spawn_children() {
-        let (p, c) = Chan::new();
+        let (tx1, rx) = channel();
         spawn(proc() {
-            let (p, c2) = Chan::new();
+            let (tx2, rx) = channel();
             spawn(proc() {
-                let (p, c3) = Chan::new();
+                let (tx3, rx) = channel();
                 spawn(proc() {
-                    c3.send(());
+                    tx3.send(());
                 });
-                p.recv();
-                c2.send(());
+                rx.recv();
+                tx2.send(());
             });
-            p.recv();
-            c.send(());
+            rx.recv();
+            tx1.send(());
         });
-        p.recv();
+        rx.recv();
     }
 
     #[test]
     fn spawn_inherits() {
-        let (p, c) = Chan::new();
+        let (tx, rx) = channel();
         spawn(proc() {
-            let c = c;
             spawn(proc() {
                 let mut task: ~Task = Local::take();
                 match task.maybe_take_runtime::<Ops>() {
@@ -342,9 +341,9 @@ mod tests {
                     None => fail!(),
                 }
                 Local::put(task);
-                c.send(());
+                tx.send(());
             });
         });
-        p.recv();
+        rx.recv();
     }
 }