blob: 5195261ffc398a940e776b3539e57bd5666eb5f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#+private
#+build openbsd
package os
import "core:c"
foreign import libc "system:c"
@(default_calling_convention="c")
foreign libc {
@(link_name="getthrid") _unix_getthrid :: proc() -> int ---
@(link_name="sysconf") _sysconf :: proc(name: c.int) -> c.long ---
}
@(require_results)
_get_current_thread_id :: proc "contextless" () -> int {
return _unix_getthrid()
}
_SC_NPROCESSORS_ONLN :: 503
@(private, require_results)
_get_processor_core_count :: proc() -> int {
return int(_sysconf(_SC_NPROCESSORS_ONLN))
}
|