Skip to content

Commit

Permalink
Merge pull request moby#28185 from Microsoft/jjh/concurrentaccess
Browse files Browse the repository at this point in the history
Windows: Avoid concurrent access to sysinfo
  • Loading branch information
John Howard authored Nov 9, 2016
2 parents d3c780b + 54e09aa commit 64a42d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/platform/architecture_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
}

0 comments on commit 64a42d6

Please sign in to comment.