mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
runtime: simplify nr_cpus
This commit is contained in:
parent
d714dcef75
commit
d63f395061
@ -4,8 +4,5 @@ fn C.sysconf(name int) i64
|
|||||||
|
|
||||||
// nr_cpus returns the number of virtual CPU cores found on the system.
|
// nr_cpus returns the number of virtual CPU cores found on the system.
|
||||||
pub fn nr_cpus() int {
|
pub fn nr_cpus() int {
|
||||||
$if linux || macos || solaris {
|
return int(C.sysconf(C._SC_NPROCESSORS_ONLN))
|
||||||
return int(C.sysconf(C._SC_NPROCESSORS_ONLN))
|
|
||||||
}
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user