about summary refs log tree commit diff
path: root/library/std/src/sys/pal/wasm/alloc.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-22 15:22:49 +0000
committerbors <bors@rust-lang.org>2024-03-22 15:22:49 +0000
commit2fae357cb87d6ec184a34892394d4e737ecd6030 (patch)
tree2e95d58c16c36d9159307f386ce1912c94bc4fff /library/std/src/sys/pal/wasm/alloc.rs
parentf61f45f2336ad473ca152252f81e447ae19e0553 (diff)
parentee57d2b318fc17080740172896269cd9865a17f4 (diff)
Auto merge of #3394 - RalfJung:rustup, r=RalfJung
Rustup
Diffstat (limited to 'library/std/src/sys/pal/wasm/alloc.rs')
-rw-r--r--library/std/src/sys/pal/wasm/alloc.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/library/std/src/sys/pal/wasm/alloc.rs b/library/std/src/sys/pal/wasm/alloc.rs
index 6dceb1689a8..b74ce0d4742 100644
--- a/library/std/src/sys/pal/wasm/alloc.rs
+++ b/library/std/src/sys/pal/wasm/alloc.rs
@@ -57,7 +57,10 @@ unsafe impl GlobalAlloc for System {
 
 #[cfg(target_feature = "atomics")]
 mod lock {
-    use crate::sync::atomic::{AtomicI32, Ordering::SeqCst};
+    use crate::sync::atomic::{
+        AtomicI32,
+        Ordering::{Acquire, Release},
+    };
 
     static LOCKED: AtomicI32 = AtomicI32::new(0);
 
@@ -65,7 +68,7 @@ mod lock {
 
     pub fn lock() -> DropLock {
         loop {
-            if LOCKED.swap(1, SeqCst) == 0 {
+            if LOCKED.swap(1, Acquire) == 0 {
                 return DropLock;
             }
             // Ok so here's where things get a little depressing. At this point
@@ -143,7 +146,7 @@ mod lock {
 
     impl Drop for DropLock {
         fn drop(&mut self) {
-            let r = LOCKED.swap(0, SeqCst);
+            let r = LOCKED.swap(0, Release);
             debug_assert_eq!(r, 1);
 
             // Note that due to the above logic we don't actually need to wake