aboutsummaryrefslogtreecommitdiff
path: root/core/sync
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2024-09-17 11:35:18 +0100
committerGitHub <noreply@github.com>2024-09-17 11:35:18 +0100
commit4a3b4da73c13f4f72df50d11b298b2bda44bbd79 (patch)
tree1568b1707733a88714d118d84512be954921ded2 /core/sync
parent09588836e73d2def550cf5b1f6dab4d9de237e37 (diff)
parent6e0f1cc866e8a566a46ccaf9f14879e7ac344fe2 (diff)
Merge pull request #4253 from pkova/master
Fix core sync test deadlock on darwin
Diffstat (limited to 'core/sync')
-rw-r--r--core/sync/futex_darwin.odin10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/sync/futex_darwin.odin b/core/sync/futex_darwin.odin
index daefd6699..32fdb1552 100644
--- a/core/sync/futex_darwin.odin
+++ b/core/sync/futex_darwin.odin
@@ -12,6 +12,7 @@ foreign System {
// __ulock_wait is not available on 10.15
// See https://github.com/odin-lang/Odin/issues/1959
__ulock_wait :: proc "c" (operation: u32, addr: rawptr, value: u64, timeout_us: u32) -> c.int ---
+ __ulock_wait2 :: proc "c" (operation: u32, addr: rawptr, value: u64, timeout_ns: u64, value2: u64) -> c.int ---
__ulock_wake :: proc "c" (operation: u32, addr: rawptr, wake_value: u64) -> c.int ---
}
@@ -52,8 +53,13 @@ _futex_wait_with_timeout :: proc "contextless" (f: ^Futex, expected: u32, durati
}
} else {
- timeout_ns := u32(duration)
- s := __ulock_wait(UL_COMPARE_AND_WAIT | ULF_NO_ERRNO, f, u64(expected), timeout_ns)
+ when darwin.ULOCK_WAIT_2_AVAILABLE {
+ timeout_ns := u64(duration)
+ s := __ulock_wait2(UL_COMPARE_AND_WAIT | ULF_NO_ERRNO, f, u64(expected), timeout_ns, 0)
+ } else {
+ timeout_us := u32(duration) * 1000
+ s := __ulock_wait(UL_COMPARE_AND_WAIT | ULF_NO_ERRNO, f, u64(expected), timeout_us)
+ }
if s >= 0 {
return true
}