mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Merge pull request #4253 from pkova/master
Fix core sync test deadlock on darwin
This commit is contained in:
@@ -12,6 +12,7 @@ foreign System {
|
|||||||
// __ulock_wait is not available on 10.15
|
// __ulock_wait is not available on 10.15
|
||||||
// See https://github.com/odin-lang/Odin/issues/1959
|
// 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_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 ---
|
__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 {
|
} else {
|
||||||
|
|
||||||
timeout_ns := u32(duration)
|
when darwin.ULOCK_WAIT_2_AVAILABLE {
|
||||||
s := __ulock_wait(UL_COMPARE_AND_WAIT | ULF_NO_ERRNO, f, u64(expected), timeout_ns)
|
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 {
|
if s >= 0 {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,15 @@ when ODIN_OS == .Darwin {
|
|||||||
} else {
|
} else {
|
||||||
WAIT_ON_ADDRESS_AVAILABLE :: false
|
WAIT_ON_ADDRESS_AVAILABLE :: false
|
||||||
}
|
}
|
||||||
|
when ODIN_MINIMUM_OS_VERSION >= 11_00_00 {
|
||||||
|
ULOCK_WAIT_2_AVAILABLE :: true
|
||||||
|
} else {
|
||||||
|
ULOCK_WAIT_2_AVAILABLE :: false
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
WAIT_ON_ADDRESS_AVAILABLE :: false
|
WAIT_ON_ADDRESS_AVAILABLE :: false
|
||||||
|
ULOCK_WAIT_2_AVAILABLE :: false
|
||||||
}
|
}
|
||||||
|
|
||||||
os_sync_wait_on_address_flag :: enum u32 {
|
os_sync_wait_on_address_flag :: enum u32 {
|
||||||
|
|||||||
@@ -4,11 +4,7 @@
|
|||||||
// Keep in mind that running with the debug logs uncommented can result in
|
// Keep in mind that running with the debug logs uncommented can result in
|
||||||
// failures disappearing due to the delay of sending the log message causing
|
// failures disappearing due to the delay of sending the log message causing
|
||||||
// different synchronization patterns.
|
// different synchronization patterns.
|
||||||
//
|
|
||||||
// These tests are temporarily disabled on Darwin, as there is currently a
|
|
||||||
// stall occurring which I cannot debug.
|
|
||||||
|
|
||||||
//+build !darwin
|
|
||||||
package test_core_sync
|
package test_core_sync
|
||||||
|
|
||||||
import "base:intrinsics"
|
import "base:intrinsics"
|
||||||
|
|||||||
Reference in New Issue
Block a user