mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
runtime: decrement default cpu amount in nr_jobs (#10841)
This commit is contained in:
@ -1,14 +1,10 @@
|
||||
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 {
|
||||
return int(C.sysconf(C._SC_NPROCESSORS_ONLN))
|
||||
}
|
||||
$if macos {
|
||||
return int(C.sysconf(C._SC_NPROCESSORS_ONLN))
|
||||
}
|
||||
$if solaris {
|
||||
$if linux || macos || solaris {
|
||||
return int(C.sysconf(C._SC_NPROCESSORS_ONLN))
|
||||
}
|
||||
return 1
|
||||
|
Reference in New Issue
Block a user