From 78580651131c9daacd7e5e4669af819cdd719f09 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 9 Mar 2014 14:58:32 -0700 Subject: std: Rename Chan/Port types and constructor * Chan => Sender * Port => Receiver * 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 --- src/libstd/rt/rtio.rs | 8 ++++---- src/libstd/rt/task.rs | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/libstd/rt') diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs index edb480fe4cb..cd557f01834 100644 --- a/src/libstd/rt/rtio.rs +++ b/src/libstd/rt/rtio.rs @@ -10,7 +10,7 @@ use c_str::CString; use cast; -use comm::{Chan, Port}; +use comm::{Sender, Receiver}; use libc::c_int; use libc; use ops::Drop; @@ -183,7 +183,7 @@ pub trait IoFactory { fn pipe_open(&mut self, fd: c_int) -> Result<~RtioPipe, IoError>; fn tty_open(&mut self, fd: c_int, readable: bool) -> Result<~RtioTTY, IoError>; - fn signal(&mut self, signal: Signum, channel: Chan) + fn signal(&mut self, signal: Signum, channel: Sender) -> Result<~RtioSignal, IoError>; } @@ -233,8 +233,8 @@ pub trait RtioUdpSocket : RtioSocket { pub trait RtioTimer { fn sleep(&mut self, msecs: u64); - fn oneshot(&mut self, msecs: u64) -> Port<()>; - fn period(&mut self, msecs: u64) -> Port<()>; + fn oneshot(&mut self, msecs: u64) -> Receiver<()>; + fn period(&mut self, msecs: u64) -> Receiver<()>; } pub trait RtioFileStream { diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index 72ba98eab4f..86e69560e9d 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -17,7 +17,7 @@ use any::AnyOwnExt; use cast; use cleanup; use clone::Clone; -use comm::Chan; +use comm::Sender; use io::Writer; use iter::{Iterator, Take}; use local_data; @@ -73,7 +73,7 @@ pub enum DeathAction { /// until all its watched children exit before collecting the status. Execute(proc(TaskResult)), /// A channel to send the result of the task on when the task exits - SendMessage(Chan), + SendMessage(Sender), } /// Per-task state related to task death, killing, failure, etc. @@ -450,16 +450,16 @@ mod test { #[test] fn comm_stream() { - let (port, chan) = Chan::new(); - chan.send(10); - assert!(port.recv() == 10); + let (tx, rx) = channel(); + tx.send(10); + assert!(rx.recv() == 10); } #[test] fn comm_shared_chan() { - let (port, chan) = Chan::new(); - chan.send(10); - assert!(port.recv() == 10); + let (tx, rx) = channel(); + tx.send(10); + assert!(rx.recv() == 10); } #[test] -- cgit 1.4.1-3-g733a5