mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-05 05:38:31 +00:00
18 lines
354 B
Odin
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)
|
|
}
|