From 54e09aa4e26c60deb74f994a08e96abea8fb857e Mon Sep 17 00:00:00 2001 From: John Howard Date: Tue, 8 Nov 2016 17:52:38 -0800 Subject: [PATCH] Windows: Avoid concurrent access to sysinfo Signed-off-by: John Howard --- pkg/platform/architecture_windows.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/platform/architecture_windows.go b/pkg/platform/architecture_windows.go index 801a834503..82c4d54a26 100644 --- a/pkg/platform/architecture_windows.go +++ b/pkg/platform/architecture_windows.go @@ -34,10 +34,9 @@ const ( ProcessorArchitectureArm = 5 // PROCESSOR_ARCHITECTURE_ARM ) -var sysinfo systeminfo - // runtimeArchitecture gets the name of the current architecture (x86, x86_64, …) func runtimeArchitecture() (string, error) { + var sysinfo systeminfo syscall.Syscall(procGetSystemInfo.Addr(), 1, uintptr(unsafe.Pointer(&sysinfo)), 0, 0) switch sysinfo.wProcessorArchitecture { case ProcessorArchitecture64, ProcessorArchitectureIA64: @@ -53,6 +52,7 @@ func runtimeArchitecture() (string, error) { // NumProcs returns the number of processors on the system func NumProcs() uint32 { + var sysinfo systeminfo syscall.Syscall(procGetSystemInfo.Addr(), 1, uintptr(unsafe.Pointer(&sysinfo)), 0, 0) return sysinfo.dwNumberOfProcessors }