From 1a76116ed0d18bd8a25337bc90e5621cba1078f1 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Tue, 22 Mar 2022 09:56:46 +0100 Subject: [PATCH] weak af --- src/mutex.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mutex.rs b/src/mutex.rs index abd5e9a..b9aeccc 100644 --- a/src/mutex.rs +++ b/src/mutex.rs @@ -34,10 +34,12 @@ impl Mutex { // don't use spin loops // but I can't be bothered with the proper solution loop { - if self - .status - .compare_exchange(INIT, ACQUIRED, Ordering::Acquire, Ordering::Relaxed) - { + if self.status.compare_exchange_weak( + INIT, + ACQUIRED, + Ordering::Acquire, + Ordering::Relaxed, + ) { return MutexGuard { mutex: self }; } else { std::hint::spin_loop();