import "unsafe"
-var (
- TestingWER = &testingWER
- TimeBeginPeriodRetValue = &timeBeginPeriodRetValue
-)
+var TestingWER = &testingWER
func NumberOfProcessors() int32 {
var info systeminfo
//go:cgo_import_dynamic runtime._WaitForSingleObject WaitForSingleObject%2 "kernel32.dll"
//go:cgo_import_dynamic runtime._WriteConsoleW WriteConsoleW%5 "kernel32.dll"
//go:cgo_import_dynamic runtime._WriteFile WriteFile%5 "kernel32.dll"
-//go:cgo_import_dynamic runtime._timeBeginPeriod timeBeginPeriod%1 "winmm.dll"
var (
// Following syscalls are available on every Windows PC.
_WSAGetOverlappedResult,
_WaitForSingleObject,
_WriteConsoleW,
- _WriteFile,
- _timeBeginPeriod stdFunction
+ _WriteFile stdFunction
// Following syscalls are only available on some Windows PCs.
// We will load syscalls, if available, before using them.
// in sys_windows_386.s and sys_windows_amd64.s
func externalthreadhandler()
-var timeBeginPeriodRetValue uint32
-
func osinit() {
asmstdcallAddr = unsafe.Pointer(funcPC(asmstdcall))
stdcall2(_SetConsoleCtrlHandler, funcPC(ctrlhandler), 1)
- timeBeginPeriodRetValue = uint32(stdcall1(_timeBeginPeriod, 1))
-
ncpu = getproccount()
// Windows dynamic priority boosting assumes that a process has different types
}
}
-func TestTimeBeginPeriod(t *testing.T) {
- const TIMERR_NOERROR = 0
- if *runtime.TimeBeginPeriodRetValue != TIMERR_NOERROR {
- t.Fatalf("timeBeginPeriod failed: it returned %d", *runtime.TimeBeginPeriodRetValue)
- }
-}
-
// removeOneCPU removes one (any) cpu from affinity mask.
// It returns new affinity mask.
func removeOneCPU(mask uintptr) (uintptr, error) {