1
1
#[ doc( hidden) ] ;
2
2
3
- export chan_from_global_ptr;
3
+ export chan_from_global_ptr, weaken_task ;
4
4
5
5
import compare_and_swap = rustrt:: rust_compare_and_swap_ptr;
6
6
@@ -32,8 +32,11 @@ unsafe fn chan_from_global_ptr<T: send>(
32
32
abort
33
33
}
34
34
35
+ log ( debug, "ENTERING chan_from_global_ptr, before is_prob_zero check" ) ;
35
36
let is_probably_zero = * global == 0 u;
37
+ log ( debug, "after is_prob_zero check" ) ;
36
38
if is_probably_zero {
39
+ log ( debug, "is probably zero..." ) ;
37
40
// There's no global channel. We must make it
38
41
39
42
let setup_po = comm:: port ( ) ;
@@ -51,14 +54,17 @@ unsafe fn chan_from_global_ptr<T: send>(
51
54
}
52
55
} ;
53
56
57
+ log ( debug, "before setup recv.." ) ;
54
58
// This is the proposed global channel
55
59
let ch = comm:: recv ( setup_po) ;
56
60
// 0 is our sentinal value. It is not a valid channel
57
61
assert unsafe:: reinterpret_cast ( ch) != 0 u;
58
62
59
63
// Install the channel
64
+ log ( debug, "BEFORE COMPARE AND SWAP" ) ;
60
65
let swapped = compare_and_swap (
61
66
global, 0 u, unsafe :: reinterpret_cast ( ch) ) ;
67
+ log ( debug, #fmt ( "AFTER .. swapped? %?" , swapped) ) ;
62
68
63
69
if swapped {
64
70
// Success!
@@ -70,6 +76,7 @@ unsafe fn chan_from_global_ptr<T: send>(
70
76
unsafe :: reinterpret_cast ( * global)
71
77
}
72
78
} else {
79
+ log ( debug, "global != 0" ) ;
73
80
unsafe :: reinterpret_cast ( * global)
74
81
}
75
82
}
0 commit comments