File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -12,26 +12,31 @@ mod imp {
1212#[ cfg( any( target_arch = "arm" , target_arch = "mips" , target_arch = "powerpc" ) ) ]
1313mod imp {
1414 use std:: sync:: atomic:: Ordering ;
15+ use std:: sync:: Mutex ;
1516
16- use crossbeam_utils:: atomic:: AtomicCell ;
17-
18- pub ( crate ) struct AtomicU64 ( AtomicCell < u64 > ) ;
17+ pub ( crate ) struct AtomicU64 ( Mutex < u64 > ) ;
1918
2019 impl AtomicU64 {
2120 pub ( crate ) const fn new ( val : u64 ) -> Self {
22- Self ( AtomicCell :: new ( val) )
21+ Self ( Mutex :: new ( val) )
2322 }
2423
2524 pub ( crate ) fn load ( & self , _: Ordering ) -> u64 {
26- self . 0 . load ( )
25+ * self . 0 . lock ( ) . unwrap ( )
2726 }
2827
2928 pub ( crate ) fn fetch_add ( & self , val : u64 , _: Ordering ) -> u64 {
30- self . 0 . fetch_add ( val)
29+ let lock = self . 0 . lock ( ) . unwrap ( ) ;
30+ let prev = * lock;
31+ * lock += val;
32+ prev
3133 }
3234
3335 pub ( crate ) fn fetch_sub ( & self , val : u64 , _: Ordering ) -> u64 {
34- self . 0 . fetch_sub ( val)
36+ let lock = self . 0 . lock ( ) . unwrap ( ) ;
37+ let prev = * lock;
38+ * lock -= val;
39+ prev
3540 }
3641 }
3742}
You can’t perform that action at this time.
0 commit comments