exporting priv::weaken_task and adding some debug logging
This commit is contained in:
parent
c6667c06c3
commit
f06362d5bb
1 changed files with 8 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#[doc(hidden)];
|
||||
|
||||
export chan_from_global_ptr;
|
||||
export chan_from_global_ptr, weaken_task;
|
||||
|
||||
import compare_and_swap = rustrt::rust_compare_and_swap_ptr;
|
||||
|
||||
|
|
@ -32,8 +32,11 @@ unsafe fn chan_from_global_ptr<T: send>(
|
|||
abort
|
||||
}
|
||||
|
||||
log(debug,"ENTERING chan_from_global_ptr, before is_prob_zero check");
|
||||
let is_probably_zero = *global == 0u;
|
||||
log(debug,"after is_prob_zero check");
|
||||
if is_probably_zero {
|
||||
log(debug,"is probably zero...");
|
||||
// There's no global channel. We must make it
|
||||
|
||||
let setup_po = comm::port();
|
||||
|
|
@ -51,14 +54,17 @@ unsafe fn chan_from_global_ptr<T: send>(
|
|||
}
|
||||
};
|
||||
|
||||
log(debug,"before setup recv..");
|
||||
// This is the proposed global channel
|
||||
let ch = comm::recv(setup_po);
|
||||
// 0 is our sentinal value. It is not a valid channel
|
||||
assert unsafe::reinterpret_cast(ch) != 0u;
|
||||
|
||||
// Install the channel
|
||||
log(debug,"BEFORE COMPARE AND SWAP");
|
||||
let swapped = compare_and_swap(
|
||||
global, 0u, unsafe::reinterpret_cast(ch));
|
||||
log(debug,#fmt("AFTER .. swapped? %?", swapped));
|
||||
|
||||
if swapped {
|
||||
// Success!
|
||||
|
|
@ -70,6 +76,7 @@ unsafe fn chan_from_global_ptr<T: send>(
|
|||
unsafe::reinterpret_cast(*global)
|
||||
}
|
||||
} else {
|
||||
log(debug, "global != 0");
|
||||
unsafe::reinterpret_cast(*global)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue