Files
Odin/base/runtime/threading_darwin.odin
2025-05-08 11:06:00 -04:00

18 lines
354 B
Odin

#+private
package runtime
foreign import lib "system:System.framework"
foreign lib {
pthread_threadid_np :: proc "c" (rawptr, ^u64) -> i32 ---
}
_get_current_thread_id :: proc "contextless" () -> int {
tid: u64
result := pthread_threadid_np(nil, &tid)
if result != 0 {
panic_contextless("Failed to get current thread ID.")
}
return int(tid)
}