mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-17 20:12:38 +00:00
`process_wait` (optionally prefaced with a `process_kill`) can be used to properly close and free resources of the process. `process_terminate` was added because `process_kill` is a forceful exit, we were missing a way to request the process to terminate.
26 lines
551 B
Odin
26 lines
551 B
Odin
#+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))
|
|
}
|