Skip to content

Commit a7f422d

Browse files
committed
Merge pull request #4503 from nickdesaulniers/incoming
Swap return value order in pipes::oneshot Issue #4496
2 parents e90142e + bb7d720 commit a7f422d

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

src/libcore/pipes.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,8 +1229,9 @@ pub type ChanOne<T: Owned> = oneshot::client::Oneshot<T>;
12291229
pub type PortOne<T: Owned> = oneshot::server::Oneshot<T>;
12301230

12311231
/// Initialiase a (send-endpoint, recv-endpoint) oneshot pipe pair.
1232-
pub fn oneshot<T: Owned>() -> (ChanOne<T>, PortOne<T>) {
1233-
oneshot::init()
1232+
pub fn oneshot<T: Owned>() -> (PortOne<T>, ChanOne<T>) {
1233+
let (chan, port) = oneshot::init();
1234+
(port, chan)
12341235
}
12351236

12361237
/**

src/libcore/private.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,8 @@ pub unsafe fn unwrap_shared_mutable_state<T: Owned>(rc: SharedMutableState<T>)
424424

425425
do task::unkillable {
426426
let ptr: ~ArcData<T> = cast::reinterpret_cast(&rc.data);
427-
let (c1,p1) = pipes::oneshot(); // ()
428-
let (c2,p2) = pipes::oneshot(); // bool
427+
let (p1,c1) = pipes::oneshot(); // ()
428+
let (p2,c2) = pipes::oneshot(); // bool
429429
let server: UnwrapProto = ~mut Some((move c1,move p2));
430430
let serverp: int = cast::transmute(move server);
431431
// Try to put our server end in the unwrapper slot.

src/libstd/arc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ mod tests {
512512
fn test_mutex_arc_condvar() {
513513
let arc = ~MutexARC(false);
514514
let arc2 = ~arc.clone();
515-
let (c,p) = pipes::oneshot();
515+
let (p,c) = pipes::oneshot();
516516
let (c,p) = (~mut Some(move c), ~mut Some(move p));
517517
do task::spawn |move arc2, move p| {
518518
// wait until parent gets in

src/libstd/sync.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl<Q: Owned> &Sem<Q> {
109109
state.count -= 1;
110110
if state.count < 0 {
111111
// Create waiter nobe.
112-
let (SignalEnd, WaitEnd) = pipes::oneshot();
112+
let (WaitEnd, SignalEnd) = pipes::oneshot();
113113
// Tell outer scope we need to block.
114114
waiter_nobe = Some(move WaitEnd);
115115
// Enqueue ourself.
@@ -216,7 +216,7 @@ impl &Condvar {
216216
*/
217217
fn wait_on(condvar_id: uint) {
218218
// Create waiter nobe.
219-
let (SignalEnd, WaitEnd) = pipes::oneshot();
219+
let (WaitEnd, SignalEnd) = pipes::oneshot();
220220
let mut WaitEnd = Some(move WaitEnd);
221221
let mut SignalEnd = Some(move SignalEnd);
222222
let mut reacquire = None;

0 commit comments

Comments
 (0)