Skip to content

Commit

Permalink
mutex: Optimize a little
Browse files Browse the repository at this point in the history
  • Loading branch information
lhmouse committed Oct 13, 2024
1 parent 0ad0148 commit 0b0d2d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mcfgthread/mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ _MCF_mutex_lock_slow(_MCF_mutex* mutex, const int64_t* timeout_opt)
new.__locked = 1;
new.__sp_mask = old.__sp_mask | (old.__sp_mask + (old.__locked & spinnable));
new.__sp_nfail = do_adjust_sp_nfail(old.__sp_nfail, (int) old.__locked * 2 - 1);
new.__nsleep = old.__nsleep + (old.__locked & ~spinnable);
new.__nsleep = old.__nsleep + (old.__locked & (spinnable - 1U));
}
while(!_MCF_atomic_cmpxchg_weak_pptr_arl(mutex, &old, &new));
#pragma GCC diagnostic pop
Expand Down

0 comments on commit 0b0d2d2

Please sign in to comment.