File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
library/std/src/sys/pal/xous Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -46,15 +46,18 @@ unsafe impl GlobalAlloc for System {
46
46
}
47
47
48
48
mod lock {
49
- use crate :: sync:: atomic:: { AtomicI32 , Ordering :: SeqCst } ;
49
+ use crate :: sync:: atomic:: {
50
+ AtomicI32 ,
51
+ Ordering :: { Acquire , Release } ,
52
+ } ;
50
53
51
54
static LOCKED : AtomicI32 = AtomicI32 :: new ( 0 ) ;
52
55
53
56
pub struct DropLock ;
54
57
55
58
pub fn lock ( ) -> DropLock {
56
59
loop {
57
- if LOCKED . swap ( 1 , SeqCst ) == 0 {
60
+ if LOCKED . swap ( 1 , Acquire ) == 0 {
58
61
return DropLock ;
59
62
}
60
63
crate :: os:: xous:: ffi:: do_yield ( ) ;
@@ -63,7 +66,7 @@ mod lock {
63
66
64
67
impl Drop for DropLock {
65
68
fn drop ( & mut self ) {
66
- let r = LOCKED . swap ( 0 , SeqCst ) ;
69
+ let r = LOCKED . swap ( 0 , Release ) ;
67
70
debug_assert_eq ! ( r, 1 ) ;
68
71
}
69
72
}
You can’t perform that action at this time.
0 commit comments