diff options
| author | bors <bors@rust-lang.org> | 2014-03-13 14:06:37 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-03-13 14:06:37 -0700 |
| commit | b4d324334cb48198c27d782002d75eba14a6abde (patch) | |
| tree | 950d8daa5e6305090bdd69625bb18ead48471865 /src/libnative/task.rs | |
| parent | 6ff3c9995e63b63c16d13739a0fc2d321f95410e (diff) | |
| parent | 78580651131c9daacd7e5e4669af819cdd719f09 (diff) | |
| download | rust-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.rs | 55 |
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(); } } |
