This commit is contained in:
nora 2022-03-22 09:56:46 +01:00
parent 972c8f6970
commit 1a76116ed0

View file

@ -34,10 +34,12 @@ impl<T> Mutex<T> {
// 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();