@@ -41,15 +41,15 @@ fn static_atomic_bool(val: bool) -> &'static AtomicBool {
41
41
}
42
42
43
43
/// Spins until it acquires a pre-determined value.
44
- fn loads_value ( loc : & AtomicI32 , ord : Ordering , val : i32 ) -> i32 {
44
+ fn spin_until_i32 ( loc : & AtomicI32 , ord : Ordering , val : i32 ) -> i32 {
45
45
while loc. load ( ord) != val {
46
46
std:: hint:: spin_loop ( ) ;
47
47
}
48
48
val
49
49
}
50
50
51
51
/// Spins until it acquires a pre-determined boolean.
52
- fn loads_bool ( loc : & AtomicBool , ord : Ordering , val : bool ) -> bool {
52
+ fn spin_until_bool ( loc : & AtomicBool , ord : Ordering , val : bool ) -> bool {
53
53
while loc. load ( ord) != val {
54
54
std:: hint:: spin_loop ( ) ;
55
55
}
@@ -73,7 +73,7 @@ fn test_corr() {
73
73
} ) ; // | |
74
74
#[ rustfmt:: skip] // |synchronizes-with |happens-before
75
75
let j3 = spawn ( move || { // | |
76
- loads_value ( & y, Acquire , 1 ) ; // <--- ---------+ |
76
+ spin_until_i32 ( & y, Acquire , 1 ) ; // <---------+ |
77
77
x. load ( Relaxed ) // <----------------------------------------------+
78
78
// The two reads on x are ordered by hb, so they cannot observe values
79
79
// differently from the modification order. If the first read observed
@@ -98,12 +98,12 @@ fn test_wrc() {
98
98
} ) ; // | |
99
99
#[ rustfmt:: skip] // |synchronizes-with |
100
100
let j2 = spawn ( move || { // | |
101
- loads_value ( & x, Acquire , 1 ) ; // <--- ---------+ |
101
+ spin_until_i32 ( & x, Acquire , 1 ) ; // <---------+ |
102
102
y. store ( 1 , Release ) ; // ---------------------+ |happens-before
103
103
} ) ; // | |
104
104
#[ rustfmt:: skip] // |synchronizes-with |
105
105
let j3 = spawn ( move || { // | |
106
- loads_value ( & y, Acquire , 1 ) ; // <--- ---------+ |
106
+ spin_until_i32 ( & y, Acquire , 1 ) ; // <---------+ |
107
107
x. load ( Relaxed ) // <-----------------------------------------------+
108
108
} ) ;
109
109
@@ -129,7 +129,7 @@ fn test_message_passing() {
129
129
#[ rustfmt:: skip] // |synchronizes-with | happens-before
130
130
let j2 = spawn ( move || { // | |
131
131
let x = x; // avoid field capturing | |
132
- loads_value ( & y, Acquire , 1 ) ; // <--- ---------+ |
132
+ spin_until_i32 ( & y, Acquire , 1 ) ; // <---------+ |
133
133
unsafe { * x. 0 } // <---------------------------------------------+
134
134
} ) ;
135
135
@@ -224,12 +224,12 @@ fn test_sync_through_rmw_and_fences() {
224
224
let go = static_atomic_bool ( false ) ;
225
225
226
226
let t1 = spawn ( move || {
227
- loads_bool ( go, Relaxed , true ) ;
227
+ spin_until_bool ( go, Relaxed , true ) ;
228
228
rdmw ( y, x, z)
229
229
} ) ;
230
230
231
231
let t2 = spawn ( move || {
232
- loads_bool ( go, Relaxed , true ) ;
232
+ spin_until_bool ( go, Relaxed , true ) ;
233
233
rdmw ( z, x, y)
234
234
} ) ;
235
235
0 commit comments