Skip to content

Commit f06362d

Browse files
olsonjefferybrson
authored andcommitted
exporting priv::weaken_task and adding some debug logging
1 parent c6667c0 commit f06362d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/libcore/priv.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[doc(hidden)];
22

3-
export chan_from_global_ptr;
3+
export chan_from_global_ptr, weaken_task;
44

55
import compare_and_swap = rustrt::rust_compare_and_swap_ptr;
66

@@ -32,8 +32,11 @@ unsafe fn chan_from_global_ptr<T: send>(
3232
abort
3333
}
3434

35+
log(debug,"ENTERING chan_from_global_ptr, before is_prob_zero check");
3536
let is_probably_zero = *global == 0u;
37+
log(debug,"after is_prob_zero check");
3638
if is_probably_zero {
39+
log(debug,"is probably zero...");
3740
// There's no global channel. We must make it
3841

3942
let setup_po = comm::port();
@@ -51,14 +54,17 @@ unsafe fn chan_from_global_ptr<T: send>(
5154
}
5255
};
5356

57+
log(debug,"before setup recv..");
5458
// This is the proposed global channel
5559
let ch = comm::recv(setup_po);
5660
// 0 is our sentinal value. It is not a valid channel
5761
assert unsafe::reinterpret_cast(ch) != 0u;
5862

5963
// Install the channel
64+
log(debug,"BEFORE COMPARE AND SWAP");
6065
let swapped = compare_and_swap(
6166
global, 0u, unsafe::reinterpret_cast(ch));
67+
log(debug,#fmt("AFTER .. swapped? %?", swapped));
6268

6369
if swapped {
6470
// Success!
@@ -70,6 +76,7 @@ unsafe fn chan_from_global_ptr<T: send>(
7076
unsafe::reinterpret_cast(*global)
7177
}
7278
} else {
79+
log(debug, "global != 0");
7380
unsafe::reinterpret_cast(*global)
7481
}
7582
}

0 commit comments

Comments
 (0)