Merge pull request #4503 from nickdesaulniers/incoming

Swap return value order in pipes::oneshot Issue #4496
This commit is contained in:
Brian Anderson 2013-01-15 17:24:24 -08:00
commit a7f422d55e
4 changed files with 8 additions and 7 deletions

View file

@ -1229,8 +1229,9 @@ pub type ChanOne<T: Owned> = oneshot::client::Oneshot<T>;
pub type PortOne<T: Owned> = oneshot::server::Oneshot<T>;
/// Initialiase a (send-endpoint, recv-endpoint) oneshot pipe pair.
pub fn oneshot<T: Owned>() -> (ChanOne<T>, PortOne<T>) {
oneshot::init()
pub fn oneshot<T: Owned>() -> (PortOne<T>, ChanOne<T>) {
let (chan, port) = oneshot::init();
(port, chan)
}
/**

View file

@ -424,8 +424,8 @@ pub unsafe fn unwrap_shared_mutable_state<T: Owned>(rc: SharedMutableState<T>)
do task::unkillable {
let ptr: ~ArcData<T> = cast::reinterpret_cast(&rc.data);
let (c1,p1) = pipes::oneshot(); // ()
let (c2,p2) = pipes::oneshot(); // bool
let (p1,c1) = pipes::oneshot(); // ()
let (p2,c2) = pipes::oneshot(); // bool
let server: UnwrapProto = ~mut Some((move c1,move p2));
let serverp: int = cast::transmute(move server);
// Try to put our server end in the unwrapper slot.

View file

@ -512,7 +512,7 @@ mod tests {
fn test_mutex_arc_condvar() {
let arc = ~MutexARC(false);
let arc2 = ~arc.clone();
let (c,p) = pipes::oneshot();
let (p,c) = pipes::oneshot();
let (c,p) = (~mut Some(move c), ~mut Some(move p));
do task::spawn |move arc2, move p| {
// wait until parent gets in

View file

@ -109,7 +109,7 @@ impl<Q: Owned> &Sem<Q> {
state.count -= 1;
if state.count < 0 {
// Create waiter nobe.
let (SignalEnd, WaitEnd) = pipes::oneshot();
let (WaitEnd, SignalEnd) = pipes::oneshot();
// Tell outer scope we need to block.
waiter_nobe = Some(move WaitEnd);
// Enqueue ourself.
@ -216,7 +216,7 @@ impl &Condvar {
*/
fn wait_on(condvar_id: uint) {
// Create waiter nobe.
let (SignalEnd, WaitEnd) = pipes::oneshot();
let (WaitEnd, SignalEnd) = pipes::oneshot();
let mut WaitEnd = Some(move WaitEnd);
let mut SignalEnd = Some(move SignalEnd);
let mut reacquire = None;