about summary refs log tree commit diff
path: root/src/libsync
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/libsync
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/libsync')
-rw-r--r--src/libsync/arc.rs67
-rw-r--r--src/libsync/comm.rs53
-rw-r--r--src/libsync/future.rs18
-rw-r--r--src/libsync/lib.rs4
-rw-r--r--src/libsync/sync/mod.rs241
-rw-r--r--src/libsync/sync/mutex.rs14
-rw-r--r--src/libsync/sync/one.rs8
-rw-r--r--src/libsync/task_pool.rs8
8 files changed, 159 insertions, 254 deletions
diff --git a/src/libsync/arc.rs b/src/libsync/arc.rs
index b50d527e3f5..faa7a9de542 100644
--- a/src/libsync/arc.rs
+++ b/src/libsync/arc.rs
@@ -20,19 +20,20 @@
  * ```rust
  * extern crate sync;
  * extern crate rand;
- * use sync::Arc;
+ *
  * use std::vec;
+ * use sync::Arc;
  *
  * fn main() {
  *     let numbers = vec::from_fn(100, |i| (i as f32) * rand::random());
  *     let shared_numbers = Arc::new(numbers);
  *
  *     for _ in range(0, 10) {
- *         let (port, chan) = Chan::new();
- *         chan.send(shared_numbers.clone());
+ *         let (tx, rx) = channel();
+ *         tx.send(shared_numbers.clone());
  *
  *         spawn(proc() {
- *             let shared_numbers = port.recv();
+ *             let shared_numbers = rx.recv();
  *             let local_numbers = shared_numbers.get();
  *
  *             // Work with the local numbers
@@ -582,16 +583,16 @@ mod tests {
         let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
         let arc_v = Arc::new(v);
 
-        let (p, c) = Chan::new();
+        let (tx, rx) = channel();
 
         task::spawn(proc() {
-            let arc_v: Arc<~[int]> = p.recv();
+            let arc_v: Arc<~[int]> = rx.recv();
 
             let v = arc_v.get().clone();
             assert_eq!(v[3], 4);
         });
 
-        c.send(arc_v.clone());
+        tx.send(arc_v.clone());
 
         assert_eq!(arc_v.get()[2], 3);
         assert_eq!(arc_v.get()[4], 5);
@@ -603,10 +604,10 @@ mod tests {
     fn test_mutex_arc_condvar() {
         let arc = ~MutexArc::new(false);
         let arc2 = ~arc.clone();
-        let (p,c) = Chan::new();
+        let (tx, rx) = channel();
         task::spawn(proc() {
             // wait until parent gets in
-            p.recv();
+            rx.recv();
             arc2.access_cond(|state, cond| {
                 *state = true;
                 cond.signal();
@@ -614,7 +615,7 @@ mod tests {
         });
 
         arc.access_cond(|state, cond| {
-            c.send(());
+            tx.send(());
             assert!(!*state);
             while !*state {
                 cond.wait();
@@ -626,10 +627,10 @@ mod tests {
     fn test_arc_condvar_poison() {
         let arc = ~MutexArc::new(1);
         let arc2 = ~arc.clone();
-        let (p, c) = Chan::new();
+        let (tx, rx) = channel();
 
         spawn(proc() {
-            let _ = p.recv();
+            let _ = rx.recv();
             arc2.access_cond(|one, cond| {
                 cond.signal();
                 // Parent should fail when it wakes up.
@@ -638,7 +639,7 @@ mod tests {
         });
 
         arc.access_cond(|one, cond| {
-            c.send(());
+            tx.send(());
             while *one == 1 {
                 cond.wait();
             }
@@ -781,7 +782,7 @@ mod tests {
     fn test_rw_arc() {
         let arc = RWArc::new(0);
         let arc2 = arc.clone();
-        let (p, c) = Chan::new();
+        let (tx, rx) = channel();
 
         task::spawn(proc() {
             arc2.write(|num| {
@@ -791,7 +792,7 @@ mod tests {
                     task::deschedule();
                     *num = tmp + 1;
                 }
-                c.send(());
+                tx.send(());
             })
         });
 
@@ -814,7 +815,7 @@ mod tests {
         }
 
         // Wait for writer to finish
-        p.recv();
+        rx.recv();
         arc.read(|num| {
             assert_eq!(*num, 10);
         })
@@ -852,42 +853,42 @@ mod tests {
         // Reader tasks
         let mut reader_convos = ~[];
         for _ in range(0, 10) {
-            let ((rp1, rc1), (rp2, rc2)) = (Chan::new(), Chan::new());
-            reader_convos.push((rc1, rp2));
+            let ((tx1, rx1), (tx2, rx2)) = (channel(), channel());
+            reader_convos.push((tx1, rx2));
             let arcn = arc.clone();
             task::spawn(proc() {
-                rp1.recv(); // wait for downgrader to give go-ahead
+                rx1.recv(); // wait for downgrader to give go-ahead
                 arcn.read(|state| {
                     assert_eq!(*state, 31337);
-                    rc2.send(());
+                    tx2.send(());
                 })
             });
         }
 
         // Writer task
         let arc2 = arc.clone();
-        let ((wp1, wc1), (wp2, wc2)) = (Chan::new(), Chan::new());
+        let ((tx1, rx1), (tx2, rx2)) = (channel(), channel());
         task::spawn(proc() {
-            wp1.recv();
+            rx1.recv();
             arc2.write_cond(|state, cond| {
                 assert_eq!(*state, 0);
                 *state = 42;
                 cond.signal();
             });
-            wp1.recv();
+            rx1.recv();
             arc2.write(|state| {
                 // This shouldn't happen until after the downgrade read
                 // section, and all other readers, finish.
                 assert_eq!(*state, 31337);
                 *state = 42;
             });
-            wc2.send(());
+            tx2.send(());
         });
 
         // Downgrader (us)
         arc.write_downgrade(|mut write_mode| {
             write_mode.write_cond(|state, cond| {
-                wc1.send(()); // send to another writer who will wake us up
+                tx1.send(()); // send to another writer who will wake us up
                 while *state == 0 {
                     cond.wait();
                 }
@@ -904,12 +905,12 @@ mod tests {
                 for &(_, ref mut rp) in reader_convos.mut_iter() {
                     rp.recv()
                 }
-                wc1.send(()); // tell writer to try again
+                tx1.send(()); // tell writer to try again
                 assert_eq!(*state, 31337);
             });
         });
 
-        wp2.recv(); // complete handshake with writer
+        rx2.recv(); // complete handshake with writer
     }
     #[cfg(test)]
     fn test_rw_write_cond_downgrade_read_race_helper() {
@@ -923,13 +924,13 @@ mod tests {
         //     "blk(&ArcCondvar { order: opt_lock, ..*cond })"
         // with just "blk(cond)".
         let x = RWArc::new(true);
-        let (wp, wc) = Chan::new();
+        let (tx, rx) = channel();
 
         // writer task
         let xw = x.clone();
         task::spawn(proc() {
             xw.write_cond(|state, c| {
-                wc.send(()); // tell downgrader it's ok to go
+                tx.send(()); // tell downgrader it's ok to go
                 c.wait();
                 // The core of the test is here: the condvar reacquire path
                 // must involve order_lock, so that it cannot race with a reader
@@ -938,7 +939,7 @@ mod tests {
             })
         });
 
-        wp.recv(); // wait for writer to get in
+        rx.recv(); // wait for writer to get in
 
         x.write_downgrade(|mut write_mode| {
             write_mode.write_cond(|state, c| {
@@ -948,12 +949,12 @@ mod tests {
             });
             // make a reader task to trigger the "reader cloud lock" handoff
             let xr = x.clone();
-            let (rp, rc) = Chan::new();
+            let (tx, rx) = channel();
             task::spawn(proc() {
-                rc.send(());
+                tx.send(());
                 xr.read(|_state| { })
             });
-            rp.recv(); // wait for reader task to exist
+            rx.recv(); // wait for reader task to exist
 
             let read_mode = x.downgrade(write_mode);
             read_mode.read(|state| {
diff --git a/src/libsync/comm.rs b/src/libsync/comm.rs
index c7d55076254..f713c13d945 100644
--- a/src/libsync/comm.rs
+++ b/src/libsync/comm.rs
@@ -20,44 +20,45 @@ use std::comm;
 
 /// An extension of `pipes::stream` that allows both sending and receiving.
 pub struct DuplexStream<T, U> {
-    priv chan: Chan<T>,
-    priv port: Port<U>,
+    priv tx: Sender<T>,
+    priv rx: Receiver<U>,
+}
+
+/// Creates a bidirectional stream.
+pub fn duplex<T: Send, U: Send>() -> (DuplexStream<T, U>, DuplexStream<U, T>) {
+    let (tx1, rx1) = channel();
+    let (tx2, rx2) = channel();
+    (DuplexStream { tx: tx1, rx: rx2 },
+     DuplexStream { tx: tx2, rx: rx1 })
 }
 
 // Allow these methods to be used without import:
 impl<T:Send,U:Send> DuplexStream<T, U> {
-    /// Creates a bidirectional stream.
-    pub fn new() -> (DuplexStream<T, U>, DuplexStream<U, T>) {
-        let (p1, c2) = Chan::new();
-        let (p2, c1) = Chan::new();
-        (DuplexStream { chan: c1, port: p1 },
-         DuplexStream { chan: c2, port: p2 })
-    }
     pub fn send(&self, x: T) {
-        self.chan.send(x)
+        self.tx.send(x)
     }
     pub fn try_send(&self, x: T) -> bool {
-        self.chan.try_send(x)
+        self.tx.try_send(x)
     }
     pub fn recv(&self) -> U {
-        self.port.recv()
+        self.rx.recv()
     }
     pub fn try_recv(&self) -> comm::TryRecvResult<U> {
-        self.port.try_recv()
+        self.rx.try_recv()
     }
     pub fn recv_opt(&self) -> Option<U> {
-        self.port.recv_opt()
+        self.rx.recv_opt()
     }
 }
 
 /// An extension of `pipes::stream` that provides synchronous message sending.
-pub struct SyncChan<T> { priv duplex_stream: DuplexStream<T, ()> }
+pub struct SyncSender<T> { priv duplex_stream: DuplexStream<T, ()> }
 /// An extension of `pipes::stream` that acknowledges each message received.
-pub struct SyncPort<T> { priv duplex_stream: DuplexStream<(), T> }
+pub struct SyncReceiver<T> { priv duplex_stream: DuplexStream<(), T> }
 
-impl<T: Send> SyncChan<T> {
+impl<T: Send> SyncSender<T> {
     pub fn send(&self, val: T) {
-        assert!(self.try_send(val), "SyncChan.send: receiving port closed");
+        assert!(self.try_send(val), "SyncSender.send: receiving port closed");
     }
 
     /// Sends a message, or report if the receiver has closed the connection
@@ -67,9 +68,9 @@ impl<T: Send> SyncChan<T> {
     }
 }
 
-impl<T: Send> SyncPort<T> {
+impl<T: Send> SyncReceiver<T> {
     pub fn recv(&self) -> T {
-        self.recv_opt().expect("SyncPort.recv: sending channel closed")
+        self.recv_opt().expect("SyncReceiver.recv: sending channel closed")
     }
 
     pub fn recv_opt(&self) -> Option<T> {
@@ -89,20 +90,20 @@ impl<T: Send> SyncPort<T> {
 
 /// Creates a stream whose channel, upon sending a message, blocks until the
 /// message is received.
-pub fn rendezvous<T: Send>() -> (SyncPort<T>, SyncChan<T>) {
-    let (chan_stream, port_stream) = DuplexStream::new();
-    (SyncPort { duplex_stream: port_stream },
-     SyncChan { duplex_stream: chan_stream })
+pub fn rendezvous<T: Send>() -> (SyncReceiver<T>, SyncSender<T>) {
+    let (chan_stream, port_stream) = duplex();
+    (SyncReceiver { duplex_stream: port_stream },
+     SyncSender { duplex_stream: chan_stream })
 }
 
 #[cfg(test)]
 mod test {
-    use comm::{DuplexStream, rendezvous};
+    use comm::{duplex, rendezvous};
 
 
     #[test]
     pub fn DuplexStream1() {
-        let (left, right) = DuplexStream::new();
+        let (left, right) = duplex();
 
         left.send(~"abc");
         right.send(123);
diff --git a/src/libsync/future.rs b/src/libsync/future.rs
index 9984d2dd0ad..74a15dc9f0e 100644
--- a/src/libsync/future.rs
+++ b/src/libsync/future.rs
@@ -104,7 +104,7 @@ impl<A> Future<A> {
 }
 
 impl<A:Send> Future<A> {
-    pub fn from_port(port: Port<A>) -> Future<A> {
+    pub fn from_receiver(rx: Receiver<A>) -> Future<A> {
         /*!
          * Create a future from a port
          *
@@ -113,7 +113,7 @@ impl<A:Send> Future<A> {
          */
 
         Future::from_fn(proc() {
-            port.recv()
+            rx.recv()
         })
     }
 
@@ -125,13 +125,13 @@ impl<A:Send> Future<A> {
          * value of the future.
          */
 
-        let (port, chan) = Chan::new();
+        let (tx, rx) = channel();
 
         spawn(proc() {
-            chan.send(blk());
+            tx.send(blk());
         });
 
-        Future::from_port(port)
+        Future::from_receiver(rx)
     }
 }
 
@@ -148,10 +148,10 @@ mod test {
     }
 
     #[test]
-    fn test_from_port() {
-        let (po, ch) = Chan::new();
-        ch.send(~"whale");
-        let mut f = Future::from_port(po);
+    fn test_from_receiver() {
+        let (tx, rx) = channel();
+        tx.send(~"whale");
+        let mut f = Future::from_receiver(rx);
         assert_eq!(f.get(), ~"whale");
     }
 
diff --git a/src/libsync/lib.rs b/src/libsync/lib.rs
index 80abcce0df3..dd6ae7c77f5 100644
--- a/src/libsync/lib.rs
+++ b/src/libsync/lib.rs
@@ -19,8 +19,8 @@
 
 pub use arc::{Arc, MutexArc, RWArc, RWWriteMode, RWReadMode, ArcCondvar, CowArc};
 pub use sync::{Mutex, RWLock, Condvar, Semaphore, RWLockWriteMode,
-    RWLockReadMode, Barrier, one, mutex};
-pub use comm::{DuplexStream, SyncChan, SyncPort, rendezvous};
+               RWLockReadMode, Barrier, one, mutex};
+pub use comm::{DuplexStream, SyncSender, SyncReceiver, rendezvous, duplex};
 pub use task_pool::TaskPool;
 pub use future::Future;
 
diff --git a/src/libsync/sync/mod.rs b/src/libsync/sync/mod.rs
index 34ec4ca28cf..3bb60046b03 100644
--- a/src/libsync/sync/mod.rs
+++ b/src/libsync/sync/mod.rs
@@ -37,17 +37,17 @@ mod mpsc_intrusive;
 
 // Each waiting task receives on one of these.
 #[doc(hidden)]
-type WaitEnd = Port<()>;
+type WaitEnd = Receiver<()>;
 #[doc(hidden)]
-type SignalEnd = Chan<()>;
+type SignalEnd = Sender<()>;
 // A doubly-ended queue of waiting tasks.
 #[doc(hidden)]
-struct WaitQueue { head: Port<SignalEnd>,
-                   tail: Chan<SignalEnd> }
+struct WaitQueue { head: Receiver<SignalEnd>,
+                   tail: Sender<SignalEnd> }
 
 impl WaitQueue {
     fn new() -> WaitQueue {
-        let (block_head, block_tail) = Chan::new();
+        let (block_tail, block_head) = channel();
         WaitQueue { head: block_head, tail: block_tail }
     }
 
@@ -83,7 +83,7 @@ impl WaitQueue {
     }
 
     fn wait_end(&self) -> WaitEnd {
-        let (wait_end, signal_end) = Chan::new();
+        let (signal_end, wait_end) = channel();
         assert!(self.tail.try_send(signal_end));
         wait_end
     }
@@ -797,28 +797,28 @@ mod tests {
     #[test]
     fn test_sem_as_cvar() {
         /* Child waits and parent signals */
-        let (p, c) = Chan::new();
+        let (tx, rx) = channel();
         let s = Semaphore::new(0);
         let s2 = s.clone();
         task::spawn(proc() {
             s2.acquire();
-            c.send(());
+            tx.send(());
         });
         for _ in range(0, 5) { task::deschedule(); }
         s.release();
-        let _ = p.recv();
+        let _ = rx.recv();
 
         /* Parent waits and child signals */
-        let (p, c) = Chan::new();
+        let (tx, rx) = channel();
         let s = Semaphore::new(0);
         let s2 = s.clone();
         task::spawn(proc() {
             for _ in range(0, 5) { task::deschedule(); }
             s2.release();
-            let _ = p.recv();
+            let _ = rx.recv();
         });
         s.acquire();
-        c.send(());
+        tx.send(());
     }
     #[test]
     fn test_sem_multi_resource() {
@@ -826,17 +826,17 @@ mod tests {
         // time, and shake hands.
         let s = Semaphore::new(2);
         let s2 = s.clone();
-        let (p1,c1) = Chan::new();
-        let (p2,c2) = Chan::new();
+        let (tx1, rx1) = channel();
+        let (tx2, rx2) = channel();
         task::spawn(proc() {
             s2.access(|| {
-                let _ = p2.recv();
-                c1.send(());
+                let _ = rx2.recv();
+                tx1.send(());
             })
         });
         s.access(|| {
-            c2.send(());
-            let _ = p1.recv();
+            tx2.send(());
+            let _ = rx1.recv();
         })
     }
     #[test]
@@ -845,19 +845,19 @@ mod tests {
         // When one blocks, it should schedule the other one.
         let s = Semaphore::new(1);
         let s2 = s.clone();
-        let (p, c) = Chan::new();
-        let mut child_data = Some((s2, c));
+        let (tx, rx) = channel();
+        let mut child_data = Some((s2, tx));
         s.access(|| {
-            let (s2, c) = child_data.take_unwrap();
+            let (s2, tx) = child_data.take_unwrap();
             task::spawn(proc() {
-                c.send(());
+                tx.send(());
                 s2.access(|| { });
-                c.send(());
+                tx.send(());
             });
-            let _ = p.recv(); // wait for child to come alive
+            let _ = rx.recv(); // wait for child to come alive
             for _ in range(0, 5) { task::deschedule(); } // let the child contend
         });
-        let _ = p.recv(); // wait for child to be done
+        let _ = rx.recv(); // wait for child to be done
     }
     /************************************************************************
      * Mutex tests
@@ -866,7 +866,7 @@ mod tests {
     fn test_mutex_lock() {
         // Unsafely achieve shared state, and do the textbook
         // "load tmp = move ptr; inc tmp; store ptr <- tmp" dance.
-        let (p, c) = Chan::new();
+        let (tx, rx) = channel();
         let m = Mutex::new();
         let m2 = m.clone();
         let mut sharedstate = ~0;
@@ -876,12 +876,12 @@ mod tests {
                 let sharedstate: &mut int =
                     unsafe { cast::transmute(ptr) };
                 access_shared(sharedstate, &m2, 10);
-                c.send(());
+                tx.send(());
             });
         }
         {
             access_shared(sharedstate, &m, 10);
-            let _ = p.recv();
+            let _ = rx.recv();
 
             assert_eq!(*sharedstate, 20);
         }
@@ -912,48 +912,48 @@ mod tests {
             cond.wait();
         });
         // Parent wakes up child
-        let (port,chan) = Chan::new();
+        let (tx, rx) = channel();
         let m3 = m.clone();
         task::spawn(proc() {
             m3.lock_cond(|cond| {
-                chan.send(());
+                tx.send(());
                 cond.wait();
-                chan.send(());
+                tx.send(());
             })
         });
-        let _ = port.recv(); // Wait until child gets in the mutex
+        let _ = rx.recv(); // Wait until child gets in the mutex
         m.lock_cond(|cond| {
             let woken = cond.signal();
             assert!(woken);
         });
-        let _ = port.recv(); // Wait until child wakes up
+        let _ = rx.recv(); // Wait until child wakes up
     }
     #[cfg(test)]
     fn test_mutex_cond_broadcast_helper(num_waiters: uint) {
         let m = Mutex::new();
-        let mut ports = ~[];
+        let mut rxs = ~[];
 
         for _ in range(0, num_waiters) {
             let mi = m.clone();
-            let (port, chan) = Chan::new();
-            ports.push(port);
+            let (tx, rx) = channel();
+            rxs.push(rx);
             task::spawn(proc() {
                 mi.lock_cond(|cond| {
-                    chan.send(());
+                    tx.send(());
                     cond.wait();
-                    chan.send(());
+                    tx.send(());
                 })
             });
         }
 
         // wait until all children get in the mutex
-        for port in ports.mut_iter() { let _ = port.recv(); }
+        for rx in rxs.mut_iter() { let _ = rx.recv(); }
         m.lock_cond(|cond| {
             let num_woken = cond.broadcast();
             assert_eq!(num_woken, num_waiters);
         });
         // wait until all children wake up
-        for port in ports.mut_iter() { let _ = port.recv(); }
+        for rx in rxs.mut_iter() { let _ = rx.recv(); }
     }
     #[test]
     fn test_mutex_cond_broadcast() {
@@ -991,81 +991,6 @@ mod tests {
         // child task must have finished by the time try returns
         m.lock(|| { })
     }
-    #[ignore(reason = "linked failure")]
-    #[test]
-    fn test_mutex_killed_cond() {
-        use std::any::Any;
-
-        // Getting killed during cond wait must not corrupt the mutex while
-        // unwinding (e.g. double unlock).
-        let m = Mutex::new();
-        let m2 = m.clone();
-
-        let result: result::Result<(), ~Any> = task::try(proc() {
-            let (p, c) = Chan::new();
-            task::spawn(proc() { // linked
-                let _ = p.recv(); // wait for sibling to get in the mutex
-                task::deschedule();
-                fail!();
-            });
-            m2.lock_cond(|cond| {
-                c.send(()); // tell sibling go ahead
-                cond.wait(); // block forever
-            })
-        });
-        assert!(result.is_err());
-        // child task must have finished by the time try returns
-        m.lock_cond(|cond| {
-            let woken = cond.signal();
-            assert!(!woken);
-        })
-    }
-    #[ignore(reason = "linked failure")]
-    #[test]
-    fn test_mutex_killed_broadcast() {
-        use std::any::Any;
-        use std::unstable::finally::Finally;
-
-        let m = Mutex::new();
-        let m2 = m.clone();
-        let (p, c) = Chan::new();
-
-        let result: result::Result<(), ~Any> = task::try(proc() {
-            let mut sibling_convos = ~[];
-            for _ in range(0, 2) {
-                let (p, c) = Chan::new();
-                sibling_convos.push(p);
-                let mi = m2.clone();
-                // spawn sibling task
-                task::spawn(proc() { // linked
-                    mi.lock_cond(|cond| {
-                        c.send(()); // tell sibling to go ahead
-                        (|| {
-                            cond.wait(); // block forever
-                        }).finally(|| {
-                            error!("task unwinding and sending");
-                            c.send(());
-                            error!("task unwinding and done sending");
-                        })
-                    })
-                });
-            }
-            for p in sibling_convos.mut_iter() {
-                let _ = p.recv(); // wait for sibling to get in the mutex
-            }
-            m2.lock(|| { });
-            c.send(sibling_convos); // let parent wait on all children
-            fail!();
-        });
-        assert!(result.is_err());
-        // child task must have finished by the time try returns
-        let mut r = p.recv();
-        for p in r.mut_iter() { p.recv(); } // wait on all its siblings
-        m.lock_cond(|cond| {
-            let woken = cond.broadcast();
-            assert_eq!(woken, 0);
-        })
-    }
     #[test]
     fn test_mutex_cond_signal_on_0() {
         // Tests that signal_on(0) is equivalent to signal().
@@ -1081,28 +1006,6 @@ mod tests {
         })
     }
     #[test]
-    #[ignore(reason = "linked failure?")]
-    fn test_mutex_different_conds() {
-        let result = task::try(proc() {
-            let m = Mutex::new_with_condvars(2);
-            let m2 = m.clone();
-            let (p, c) = Chan::new();
-            task::spawn(proc() {
-                m2.lock_cond(|cond| {
-                    c.send(());
-                    cond.wait_on(1);
-                })
-            });
-            let _ = p.recv();
-            m.lock_cond(|cond| {
-                if !cond.signal_on(0) {
-                    fail!(); // success; punt sibling awake.
-                }
-            })
-        });
-        assert!(result.is_err());
-    }
-    #[test]
     fn test_mutex_no_condvars() {
         let result = task::try(proc() {
             let m = Mutex::new_with_condvars(0);
@@ -1143,11 +1046,11 @@ mod tests {
     }
     #[cfg(test)]
     fn test_rwlock_exclusion(x: &RWLock,
-                                 mode1: RWLockMode,
-                                 mode2: RWLockMode) {
+                             mode1: RWLockMode,
+                             mode2: RWLockMode) {
         // Test mutual exclusion between readers and writers. Just like the
         // mutex mutual exclusion test, a ways above.
-        let (p, c) = Chan::new();
+        let (tx, rx) = channel();
         let x2 = x.clone();
         let mut sharedstate = ~0;
         {
@@ -1156,12 +1059,12 @@ mod tests {
                 let sharedstate: &mut int =
                     unsafe { cast::transmute(ptr) };
                 access_shared(sharedstate, &x2, mode1, 10);
-                c.send(());
+                tx.send(());
             });
         }
         {
             access_shared(sharedstate, x, mode2, 10);
-            let _ = p.recv();
+            let _ = rx.recv();
 
             assert_eq!(*sharedstate, 20);
         }
@@ -1198,29 +1101,29 @@ mod tests {
                                  make_mode2_go_first: bool) {
         // Much like sem_multi_resource.
         let x2 = x.clone();
-        let (p1, c1) = Chan::new();
-        let (p2, c2) = Chan::new();
+        let (tx1, rx1) = channel();
+        let (tx2, rx2) = channel();
         task::spawn(proc() {
             if !make_mode2_go_first {
-                let _ = p2.recv(); // parent sends to us once it locks, or ...
+                let _ = rx2.recv(); // parent sends to us once it locks, or ...
             }
             lock_rwlock_in_mode(&x2, mode2, || {
                 if make_mode2_go_first {
-                    c1.send(()); // ... we send to it once we lock
+                    tx1.send(()); // ... we send to it once we lock
                 }
-                let _ = p2.recv();
-                c1.send(());
+                let _ = rx2.recv();
+                tx1.send(());
             })
         });
         if make_mode2_go_first {
-            let _ = p1.recv(); // child sends to us once it locks, or ...
+            let _ = rx1.recv(); // child sends to us once it locks, or ...
         }
         lock_rwlock_in_mode(x, mode1, || {
             if !make_mode2_go_first {
-                c2.send(()); // ... we send to it once we lock
+                tx2.send(()); // ... we send to it once we lock
             }
-            c2.send(());
-            let _ = p1.recv();
+            tx2.send(());
+            let _ = rx1.recv();
         })
     }
     #[test]
@@ -1264,22 +1167,22 @@ mod tests {
             cond.wait();
         });
         // Parent wakes up child
-        let (port, chan) = Chan::new();
+        let (tx, rx) = channel();
         let x3 = x.clone();
         task::spawn(proc() {
             x3.write_cond(|cond| {
-                chan.send(());
+                tx.send(());
                 cond.wait();
-                chan.send(());
+                tx.send(());
             })
         });
-        let _ = port.recv(); // Wait until child gets in the rwlock
+        let _ = rx.recv(); // Wait until child gets in the rwlock
         x.read(|| { }); // Must be able to get in as a reader in the meantime
         x.write_cond(|cond| { // Or as another writer
             let woken = cond.signal();
             assert!(woken);
         });
-        let _ = port.recv(); // Wait until child wakes up
+        let _ = rx.recv(); // Wait until child wakes up
         x.read(|| { }); // Just for good measure
     }
     #[cfg(test)]
@@ -1297,29 +1200,29 @@ mod tests {
             }
         }
         let x = RWLock::new();
-        let mut ports = ~[];
+        let mut rxs = ~[];
 
         for _ in range(0, num_waiters) {
             let xi = x.clone();
-            let (port, chan) = Chan::new();
-            ports.push(port);
+            let (tx, rx) = channel();
+            rxs.push(rx);
             task::spawn(proc() {
                 lock_cond(&xi, dg1, |cond| {
-                    chan.send(());
+                    tx.send(());
                     cond.wait();
-                    chan.send(());
+                    tx.send(());
                 })
             });
         }
 
         // wait until all children get in the mutex
-        for port in ports.mut_iter() { let _ = port.recv(); }
+        for rx in rxs.mut_iter() { let _ = rx.recv(); }
         lock_cond(&x, dg2, |cond| {
             let num_woken = cond.broadcast();
             assert_eq!(num_woken, num_waiters);
         });
         // wait until all children wake up
-        for port in ports.mut_iter() { let _ = port.recv(); }
+        for rx in rxs.mut_iter() { let _ = rx.recv(); }
     }
     #[test]
     fn test_rwlock_cond_broadcast() {
@@ -1400,20 +1303,20 @@ mod tests {
     #[test]
     fn test_barrier() {
         let barrier = Barrier::new(10);
-        let (port, chan) = Chan::new();
+        let (tx, rx) = channel();
 
         for _ in range(0, 9) {
             let c = barrier.clone();
-            let chan = chan.clone();
+            let tx = tx.clone();
             spawn(proc() {
                 c.wait();
-                chan.send(true);
+                tx.send(true);
             });
         }
 
         // At this point, all spawned tasks should be blocked,
         // so we shouldn't get anything from the port
-        assert!(match port.try_recv() {
+        assert!(match rx.try_recv() {
             Empty => true,
             _ => false,
         });
@@ -1421,7 +1324,7 @@ mod tests {
         barrier.wait();
         // Now, the barrier is cleared and we should get data.
         for _ in range(0, 9) {
-            port.recv();
+            rx.recv();
         }
     }
 }
diff --git a/src/libsync/sync/mutex.rs b/src/libsync/sync/mutex.rs
index ee044356aff..9901cda423b 100644
--- a/src/libsync/sync/mutex.rs
+++ b/src/libsync/sync/mutex.rs
@@ -532,17 +532,17 @@ mod test {
             }
         }
 
-        let (p, c) = Chan::new();
+        let (tx, rx) = channel();
         for _ in range(0, N) {
-            let c2 = c.clone();
-            native::task::spawn(proc() { inc(); c2.send(()); });
-            let c2 = c.clone();
-            spawn(proc() { inc(); c2.send(()); });
+            let tx2 = tx.clone();
+            native::task::spawn(proc() { inc(); tx2.send(()); });
+            let tx2 = tx.clone();
+            spawn(proc() { inc(); tx2.send(()); });
         }
 
-        drop(c);
+        drop(tx);
         for _ in range(0, 2 * N) {
-            p.recv();
+            rx.recv();
         }
         assert_eq!(unsafe {CNT}, M * N * 2);
         unsafe {
diff --git a/src/libsync/sync/one.rs b/src/libsync/sync/one.rs
index a651f3b9d4c..c5e83bed0ed 100644
--- a/src/libsync/sync/one.rs
+++ b/src/libsync/sync/one.rs
@@ -137,9 +137,9 @@ mod test {
         static mut o: Once = ONCE_INIT;
         static mut run: bool = false;
 
-        let (p, c) = Chan::new();
+        let (tx, rx) = channel();
         for _ in range(0, 10) {
-            let c = c.clone();
+            let tx = tx.clone();
             spawn(proc() {
                 for _ in range(0, 4) { task::deschedule() }
                 unsafe {
@@ -149,7 +149,7 @@ mod test {
                     });
                     assert!(run);
                 }
-                c.send(());
+                tx.send(());
             });
         }
 
@@ -162,7 +162,7 @@ mod test {
         }
 
         for _ in range(0, 10) {
-            p.recv();
+            rx.recv();
         }
     }
 }
diff --git a/src/libsync/task_pool.rs b/src/libsync/task_pool.rs
index 0d8cccfe2b9..93487827200 100644
--- a/src/libsync/task_pool.rs
+++ b/src/libsync/task_pool.rs
@@ -23,7 +23,7 @@ enum Msg<T> {
 }
 
 pub struct TaskPool<T> {
-    priv channels: ~[Chan<Msg<T>>],
+    priv channels: ~[Sender<Msg<T>>],
     priv next_index: uint,
 }
 
@@ -48,13 +48,13 @@ impl<T> TaskPool<T> {
         assert!(n_tasks >= 1);
 
         let channels = vec::from_fn(n_tasks, |i| {
-            let (port, chan) = Chan::<Msg<T>>::new();
+            let (tx, rx) = channel::<Msg<T>>();
             let init_fn = init_fn_factory();
 
             let task_body: proc() = proc() {
                 let local_data = init_fn(i);
                 loop {
-                    match port.recv() {
+                    match rx.recv() {
                         Execute(f) => f(&local_data),
                         Quit => break
                     }
@@ -64,7 +64,7 @@ impl<T> TaskPool<T> {
             // Run on this scheduler.
             task::spawn(task_body);
 
-            chan
+            tx
         });
 
         return TaskPool { channels: channels, next_index: 0 };