diff options
| author | Jesse Meyer <jesse.r.meyer@me.com> | 2026-02-03 20:52:52 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-03 20:52:52 -0500 |
| commit | b8276065f9296754d1e76e25d6661b7b5567e3e1 (patch) | |
| tree | 7b8783d43193c16e4ef393a175fede50a8fe52dd /src/threading.cpp | |
| parent | bd6148dd6b77920cf64fea8804b205e8257e8a66 (diff) | |
| parent | 270df36468df8f89e1ac944205272469142c7a65 (diff) | |
Merge branch 'master' into lto-support
Diffstat (limited to 'src/threading.cpp')
| -rw-r--r-- | src/threading.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/threading.cpp b/src/threading.cpp index 02e6de14b..d8ae321f5 100644 --- a/src/threading.cpp +++ b/src/threading.cpp @@ -375,8 +375,8 @@ gb_internal void semaphore_wait(Semaphore *s) { } gb_internal bool mutex_try_lock(BlockingMutex *m) { ANNOTATE_LOCK_PRE(m, 1); - i32 v = m->state().exchange(Internal_Mutex_State_Locked, std::memory_order_acquire); - if (v == Internal_Mutex_State_Unlocked) { + i32 expected = Internal_Mutex_State_Unlocked; + if (m->state().compare_exchange_strong(expected, Internal_Mutex_State_Locked, std::memory_order_acquire)) { ANNOTATE_LOCK_POST(m); return true; } |