aboutsummaryrefslogtreecommitdiff
path: root/src/threading.cpp
diff options
context:
space:
mode:
authorTohei Ichikawa <ichikawa.tohei.desu@gmail.com>2025-09-24 21:09:31 -0400
committerTohei Ichikawa <ichikawa.tohei.desu@gmail.com>2025-09-24 21:09:31 -0400
commit6ed9351955a8996418a8da10cd7b0da179734095 (patch)
tree1ddd4476a5b9d2af23f3240eaf31e7bfe28df9f1 /src/threading.cpp
parent3c1238991ba6f68f4ea31ca8ed368387821fa7d7 (diff)
parent5d3092bf2d00a46311a5f785658f04c823a9f3fa (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/threading.cpp')
-rw-r--r--src/threading.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/threading.cpp b/src/threading.cpp
index a35176ce6..84f09912d 100644
--- a/src/threading.cpp
+++ b/src/threading.cpp
@@ -195,7 +195,13 @@ gb_internal void mutex_lock(RecursiveMutex *m) {
// inside the lock
return;
}
- futex_wait(&m->owner, prev_owner);
+
+ // NOTE(lucas): we are doing spin lock since futex signal is expensive on OSX. The recursive locks are
+ // very short lived so we don't hit this mega often and I see no perform regression on windows (with
+ // a performance uplift on OSX).
+
+ //futex_wait(&m->owner, prev_owner);
+ yield_thread();
}
}
gb_internal bool mutex_try_lock(RecursiveMutex *m) {
@@ -216,7 +222,9 @@ gb_internal void mutex_unlock(RecursiveMutex *m) {
return;
}
m->owner.exchange(0, std::memory_order_release);
- futex_signal(&m->owner);
+ // NOTE(lucas): see comment about spin lock in mutex_lock above
+
+ // futex_signal(&m->owner);
// outside the lock
}