mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #28185 from Microsoft/jjh/concurrentaccess
Windows: Avoid concurrent access to sysinfo
This commit is contained in:
commit
64a42d656b
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue