mirror of
https://github.com/golang/go
synced 2024-11-05 14:46:11 -07:00
runtime: test that timeBeginPeriod succeeds
Change-Id: I5183f767dadb6d24a34d2460d02e97ddbaab129a Reviewed-on: https://go-review.googlesource.com/12546 Run-TryBot: Minux Ma <minux@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
b0a1f6462f
commit
d02a4c1d60
@ -6,4 +6,7 @@
|
||||
|
||||
package runtime
|
||||
|
||||
var TestingWER = &testingWER
|
||||
var (
|
||||
TestingWER = &testingWER
|
||||
TimeBeginPeriodRetValue = &timeBeginPeriodRetValue
|
||||
)
|
||||
|
@ -139,6 +139,8 @@ const (
|
||||
// in sys_windows_386.s and sys_windows_amd64.s
|
||||
func externalthreadhandler()
|
||||
|
||||
var timeBeginPeriodRetValue uint32
|
||||
|
||||
func osinit() {
|
||||
asmstdcallAddr = unsafe.Pointer(funcPC(asmstdcall))
|
||||
|
||||
@ -154,7 +156,7 @@ func osinit() {
|
||||
|
||||
stdcall2(_SetConsoleCtrlHandler, funcPC(ctrlhandler), 1)
|
||||
|
||||
stdcall1(_timeBeginPeriod, 1)
|
||||
timeBeginPeriodRetValue = uint32(stdcall1(_timeBeginPeriod, 1))
|
||||
|
||||
ncpu = getproccount()
|
||||
|
||||
|
@ -640,3 +640,10 @@ uintptr_t cfunc(callback f, uintptr_t n) {
|
||||
t.Errorf("got %d want %d", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTimeBeginPeriod(t *testing.T) {
|
||||
const TIMERR_NOERROR = 0
|
||||
if *runtime.TimeBeginPeriodRetValue != TIMERR_NOERROR {
|
||||
t.Fatalf("timeBeginPeriod failed: it returned %d", *runtime.TimeBeginPeriodRetValue)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user