mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
runtime: simplify nr_cpus(), add a test for nr_jobs()
This commit is contained in:
parent
fb4c3ff31a
commit
c60948e52e
4 changed files with 16 additions and 32 deletions
|
@ -2,15 +2,10 @@ module runtime
|
|||
|
||||
import os
|
||||
|
||||
fn nr_cpus_win() int {
|
||||
pub fn nr_cpus() int {
|
||||
mut nr := int(C.GetCurrentProcessorNumber())
|
||||
if nr == 0 {
|
||||
nr = os.getenv('NUMBER_OF_PROCESSORS').int()
|
||||
}
|
||||
return nr
|
||||
}
|
||||
|
||||
fn nr_cpus_nix() int {
|
||||
eprintln('nr_cpus_nix should be callable only for nix platforms')
|
||||
return 1
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue