2019-11-15 14:14:28 +01:00
|
|
|
module runtime
|
|
|
|
|
|
|
|
fn nr_cpus_nix() int {
|
|
|
|
$if linux {
|
|
|
|
return int(C.sysconf(C._SC_NPROCESSORS_ONLN))
|
|
|
|
}
|
2020-01-09 11:12:35 +01:00
|
|
|
$if macos {
|
2019-11-15 14:14:28 +01:00
|
|
|
return int(C.sysconf(C._SC_NPROCESSORS_ONLN))
|
|
|
|
}
|
2020-03-21 09:48:02 +01:00
|
|
|
$if solaris {
|
|
|
|
return int(C.sysconf(C._SC_NPROCESSORS_ONLN))
|
|
|
|
}
|
2019-11-15 14:14:28 +01:00
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
fn nr_cpus_win() int {
|
|
|
|
eprintln('nr_cpus_win should be callable only for windows')
|
|
|
|
return 1
|
|
|
|
}
|