diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-12-11 12:26:41 -0800 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-12-11 19:23:28 -0800 |
| commit | 38bd694df14a1b83ff8edaf5246785579fb812c0 (patch) | |
| tree | 5d64bf389f009af92f7a9dd5b2ea955fe69c6071 /src/libcore | |
| parent | b0a01f25638857edaf73d46d634a196781e3019a (diff) | |
| download | rust-38bd694df14a1b83ff8edaf5246785579fb812c0.tar.gz rust-38bd694df14a1b83ff8edaf5246785579fb812c0.zip | |
Reverse the order of the results of pipes::stream
As per #3637.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/pipes.rs | 12 | ||||
| -rw-r--r-- | src/libcore/private.rs | 2 | ||||
| -rw-r--r-- | src/libcore/task/mod.rs | 10 | ||||
| -rw-r--r-- | src/libcore/task/spawn.rs | 4 |
4 files changed, 14 insertions, 14 deletions
diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index c298213fb7c..f01bf890191 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -978,10 +978,10 @@ pub enum Port<T:Send> { These allow sending or receiving an unlimited number of messages. */ -pub fn stream<T:Send>() -> (Chan<T>, Port<T>) { +pub fn stream<T:Send>() -> (Port<T>, Chan<T>) { let (c, s) = streamp::init(); - (Chan_({ mut endp: Some(move c) }), Port_({ mut endp: Some(move s) })) + (Port_({ mut endp: Some(move s) }), Chan_({ mut endp: Some(move c) })) } impl<T: Send> Chan<T>: GenericChan<T> { @@ -1070,7 +1070,7 @@ impl<T: Send> PortSet<T> { } fn chan() -> Chan<T> { - let (ch, po) = stream(); + let (po, ch) = stream(); self.add(move po); move ch } @@ -1240,8 +1240,8 @@ pub mod rt { pub mod test { #[test] pub fn test_select2() { - let (c1, p1) = pipes::stream(); - let (c2, p2) = pipes::stream(); + let (p1, c1) = pipes::stream(); + let (p2, c2) = pipes::stream(); c1.send(~"abc"); @@ -1264,7 +1264,7 @@ pub mod test { #[test] fn test_peek_terminated() { - let (chan, port): (Chan<int>, Port<int>) = stream(); + let (port, chan): (Port<int>, Chan<int>) = stream(); { // Destroy the channel diff --git a/src/libcore/private.rs b/src/libcore/private.rs index 2b6156b14c4..bc85dcbbbf8 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -576,7 +576,7 @@ pub mod tests { for uint::range(0, num_tasks) |_i| { let total = total.clone(); - let (chan, port) = pipes::stream(); + let (port, chan) = pipes::stream(); futures.push(move port); do task::spawn |move total, move chan| { diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index 188b7c33467..98da3f50318 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -340,7 +340,7 @@ impl TaskBuilder { } // Construct the future and give it to the caller. - let (notify_pipe_ch, notify_pipe_po) = stream::<TaskResult>(); + let (notify_pipe_po, notify_pipe_ch) = stream::<TaskResult>(); blk(move notify_pipe_po); @@ -1211,7 +1211,7 @@ fn test_unkillable() { #[ignore(cfg(windows))] #[should_fail] fn test_unkillable_nested() { - let (ch, po) = pipes::stream(); + let (po, ch) = pipes::stream(); // We want to do this after failing do spawn_unlinked |move ch| { @@ -1277,7 +1277,7 @@ fn test_child_doesnt_ref_parent() { #[test] fn test_sched_thread_per_core() { - let (chan, port) = pipes::stream(); + let (port, chan) = pipes::stream(); do spawn_sched(ThreadPerCore) |move chan| { let cores = rt::rust_num_threads(); @@ -1291,7 +1291,7 @@ fn test_sched_thread_per_core() { #[test] fn test_spawn_thread_on_demand() { - let (chan, port) = pipes::stream(); + let (port, chan) = pipes::stream(); do spawn_sched(ManualThreads(2)) |move chan| { let max_threads = rt::rust_sched_threads(); @@ -1299,7 +1299,7 @@ fn test_spawn_thread_on_demand() { let running_threads = rt::rust_sched_current_nonlazy_threads(); assert(running_threads as int == 1); - let (chan2, port2) = pipes::stream(); + let (port2, chan2) = pipes::stream(); do spawn() |move chan2| { chan2.send(()); diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 05f775d08d4..61e358e1e30 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -670,7 +670,7 @@ fn test_spawn_raw_unsupervise() { #[test] #[ignore(cfg(windows))] fn test_spawn_raw_notify_success() { - let (notify_ch, notify_po) = pipes::stream(); + let (notify_po, notify_ch) = pipes::stream(); let opts = { notify_chan: Some(move notify_ch), @@ -685,7 +685,7 @@ fn test_spawn_raw_notify_success() { #[ignore(cfg(windows))] fn test_spawn_raw_notify_failure() { // New bindings for these - let (notify_ch, notify_po) = pipes::stream(); + let (notify_po, notify_ch) = pipes::stream(); let opts = { linked: false, |
