blob: a5c69b054469c82a8f9bd81a09cbda15e17d29b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
module runtime
fn C.sysconf(name int) i64
// nr_cpus returns the number of virtual CPU cores found on the system.
pub fn nr_cpus() int {
$if linux || macos || solaris {
return int(C.sysconf(C._SC_NPROCESSORS_ONLN))
}
return 1
}
|