Skip to content

Commit

Permalink
mutex: Revert spin flag load op
Browse files Browse the repository at this point in the history
It made locking much slower on ARM64.

This reverts commit 77c9ce0.
  • Loading branch information
lhmouse committed Nov 7, 2024
1 parent 32ffbaa commit c4b87c5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions mcfgthread/mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,8 @@ _MCF_mutex_lock_slow(_MCF_mutex* mutex, const int64_t* timeout_opt)
spin_count --;
YieldProcessor();

/* Wait for my turn. */
if(_MCF_atomic_load_b_rlx(do_spin_byte_ptr(mutex, my_mask)) == false)
continue;

/* Wait for my turn. It's the simplest and fastest way to perform
* just an atomic exchange, on both x86 and ARM. */
if(_MCF_atomic_xchg_b_rlx(do_spin_byte_ptr(mutex, my_mask), false) == false)
continue;

Expand Down

0 comments on commit c4b87c5

Please sign in to comment.