@@ -41,15 +41,15 @@ fn static_atomic_bool(val: bool) -> &'static AtomicBool {
4141}
4242
4343/// 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 {
4545 while loc. load ( ord) != val {
4646 std:: hint:: spin_loop ( ) ;
4747 }
4848 val
4949}
5050
5151/// 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 {
5353 while loc. load ( ord) != val {
5454 std:: hint:: spin_loop ( ) ;
5555 }
@@ -73,7 +73,7 @@ fn test_corr() {
7373 } ) ; // | |
7474 #[ rustfmt:: skip] // |synchronizes-with |happens-before
7575 let j3 = spawn ( move || { // | |
76- loads_value ( & y, Acquire , 1 ) ; // <--- ---------+ |
76+ spin_until_i32 ( & y, Acquire , 1 ) ; // <---------+ |
7777 x. load ( Relaxed ) // <----------------------------------------------+
7878 // The two reads on x are ordered by hb, so they cannot observe values
7979 // differently from the modification order. If the first read observed
@@ -98,12 +98,12 @@ fn test_wrc() {
9898 } ) ; // | |
9999 #[ rustfmt:: skip] // |synchronizes-with |
100100 let j2 = spawn ( move || { // | |
101- loads_value ( & x, Acquire , 1 ) ; // <--- ---------+ |
101+ spin_until_i32 ( & x, Acquire , 1 ) ; // <---------+ |
102102 y. store ( 1 , Release ) ; // ---------------------+ |happens-before
103103 } ) ; // | |
104104 #[ rustfmt:: skip] // |synchronizes-with |
105105 let j3 = spawn ( move || { // | |
106- loads_value ( & y, Acquire , 1 ) ; // <--- ---------+ |
106+ spin_until_i32 ( & y, Acquire , 1 ) ; // <---------+ |
107107 x. load ( Relaxed ) // <-----------------------------------------------+
108108 } ) ;
109109
@@ -129,7 +129,7 @@ fn test_message_passing() {
129129 #[ rustfmt:: skip] // |synchronizes-with | happens-before
130130 let j2 = spawn ( move || { // | |
131131 let x = x; // avoid field capturing | |
132- loads_value ( & y, Acquire , 1 ) ; // <--- ---------+ |
132+ spin_until_i32 ( & y, Acquire , 1 ) ; // <---------+ |
133133 unsafe { * x. 0 } // <---------------------------------------------+
134134 } ) ;
135135
@@ -224,12 +224,12 @@ fn test_sync_through_rmw_and_fences() {
224224 let go = static_atomic_bool ( false ) ;
225225
226226 let t1 = spawn ( move || {
227- loads_bool ( go, Relaxed , true ) ;
227+ spin_until_bool ( go, Relaxed , true ) ;
228228 rdmw ( y, x, z)
229229 } ) ;
230230
231231 let t2 = spawn ( move || {
232- loads_bool ( go, Relaxed , true ) ;
232+ spin_until_bool ( go, Relaxed , true ) ;
233233 rdmw ( z, x, y)
234234 } ) ;
235235
0 commit comments