mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
runtime: simplify nr_cpus(), add a test for nr_jobs()
This commit is contained in:

committed by
GitHub

parent
fb4c3ff31a
commit
c60948e52e
@ -1,6 +1,6 @@
|
||||
module runtime
|
||||
|
||||
fn nr_cpus_nix() int {
|
||||
pub fn nr_cpus() int {
|
||||
$if linux {
|
||||
return int(C.sysconf(C._SC_NPROCESSORS_ONLN))
|
||||
}
|
||||
@ -11,9 +11,4 @@ fn nr_cpus_nix() int {
|
||||
return int(C.sysconf(C._SC_NPROCESSORS_ONLN))
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fn nr_cpus_win() int {
|
||||
eprintln('nr_cpus_win should be callable only for windows')
|
||||
return 1
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user