Skip to content

Commit e2e64bd

Browse files
committed
---
yaml --- r: 36718 b: refs/heads/try2 c: 01a6524 h: refs/heads/master v: v3
1 parent 9096b4d commit e2e64bd

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: c35a8589ab66ee42965709f403b3032f757a79a8
8+
refs/heads/try2: 01a6524d003e89cf04e2aa1b3fd244830596eba2
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try2/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)