File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
library/std/src/sys/pal/wasm Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -57,15 +57,18 @@ unsafe impl GlobalAlloc for System {
57
57
58
58
#[ cfg( target_feature = "atomics" ) ]
59
59
mod lock {
60
- use crate :: sync:: atomic:: { AtomicI32 , Ordering :: SeqCst } ;
60
+ use crate :: sync:: atomic:: {
61
+ AtomicI32 ,
62
+ Ordering :: { Acquire , Release } ,
63
+ } ;
61
64
62
65
static LOCKED : AtomicI32 = AtomicI32 :: new ( 0 ) ;
63
66
64
67
pub struct DropLock ;
65
68
66
69
pub fn lock ( ) -> DropLock {
67
70
loop {
68
- if LOCKED . swap ( 1 , SeqCst ) == 0 {
71
+ if LOCKED . swap ( 1 , Acquire ) == 0 {
69
72
return DropLock ;
70
73
}
71
74
// Ok so here's where things get a little depressing. At this point
@@ -143,7 +146,7 @@ mod lock {
143
146
144
147
impl Drop for DropLock {
145
148
fn drop ( & mut self ) {
146
- let r = LOCKED . swap ( 0 , SeqCst ) ;
149
+ let r = LOCKED . swap ( 0 , Release ) ;
147
150
debug_assert_eq ! ( r, 1 ) ;
148
151
149
152
// Note that due to the above logic we don't actually need to wake
You can’t perform that action at this time.
0 commit comments