Skip to content

Commit 79aebcf

Browse files
committed
---
yaml --- r: 39383 b: refs/heads/incoming c: 01a6524 h: refs/heads/master i: 39381: 500fe0f 39379: 670844a 39375: 4c72ea8 v: v3
1 parent 5408a7c commit 79aebcf

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
9-
refs/heads/incoming: c35a8589ab66ee42965709f403b3032f757a79a8
9+
refs/heads/incoming: 01a6524d003e89cf04e2aa1b3fd244830596eba2
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libcore/private.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,29 @@ pub unsafe fn chan_from_global_ptr<T: Owned>(
7070
log(debug,~"is probably zero...");
7171
// There's no global channel. We must make it
7272
73-
let (setup_po, setup_ch) = do task_fn().spawn_conversation
74-
|move f, setup_po, setup_ch| {
73+
let (setup1_po, setup1_ch) = pipes::stream();
74+
let (setup2_po, setup2_ch) = pipes::stream();
75+
76+
// XXX: Ugly type inference hints
77+
let setup1_po: pipes::Port<comm::Chan<T>> = setup1_po;
78+
let setup2_po: pipes::Port<Msg> = setup2_po;
79+
80+
do task_fn().spawn |move f, move setup1_ch, move setup2_po| {
7581
let po = comm::Port::<T>();
7682
let ch = comm::Chan(&po);
77-
comm::send(setup_ch, ch);
83+
setup1_ch.send(ch);
7884
7985
// Wait to hear if we are the official instance of
8086
// this global task
81-
match comm::recv::<Msg>(setup_po) {
87+
match setup2_po.recv() {
8288
Proceed => f(move po),
8389
Abort => ()
8490
}
8591
};
8692
8793
log(debug,~"before setup recv..");
8894
// This is the proposed global channel
89-
let ch = comm::recv(setup_po);
95+
let ch = setup1_po.recv();
9096
// 0 is our sentinal value. It is not a valid channel
9197
assert *ch != 0;
9298
@@ -99,11 +105,11 @@ pub unsafe fn chan_from_global_ptr<T: Owned>(
99105

100106
if swapped {
101107
// Success!
102-
comm::send(setup_ch, Proceed);
108+
setup2_ch.send(Proceed);
103109
ch
104110
} else {
105111
// Somebody else got in before we did
106-
comm::send(setup_ch, Abort);
112+
setup2_ch.send(Abort);
107113
cast::reinterpret_cast(&*global)
108114
}
109115
} else {

0 commit comments

Comments
 (0)