diff --git a/vlib/runtime/runtime_windows.c.v b/vlib/runtime/runtime_windows.c.v index 9b3e7259cd..6a345644bf 100644 --- a/vlib/runtime/runtime_windows.c.v +++ b/vlib/runtime/runtime_windows.c.v @@ -2,8 +2,16 @@ module runtime import os +[typedef] +struct C.SYSTEM_INFO { + dwNumberOfProcessors u32 +} +fn C.GetSystemInfo(&C.SYSTEM_INFO) + pub fn nr_cpus() int { - mut nr := int(C.GetCurrentProcessorNumber()) + sinfo := C.SYSTEM_INFO{} + C.GetSystemInfo(&sinfo) + mut nr := int(sinfo.dwNumberOfProcessors) if nr == 0 { nr = os.getenv('NUMBER_OF_PROCESSORS').int() }