1
0
mirror of https://github.com/golang/go synced 2024-11-22 03:44:39 -07:00

time: Sleep does better job then runtime.Gosched in TestAfterStress

for slow windows-386 builder

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/7128053
This commit is contained in:
Alex Brainman 2013-01-18 15:31:01 +11:00
parent 60b9cd535c
commit e0aa26a427

View File

@ -54,9 +54,10 @@ func TestAfterStress(t *testing.T) {
go func() {
for atomic.LoadUint32(&stop) == 0 {
runtime.GC()
// Need to yield, because otherwise
// the main goroutine will never set the stop flag.
runtime.Gosched()
// Yield so that the OS can wake up the timer thread,
// so that it can generate channel sends for the main goroutine,
// which will eventually set stop = 1 for us.
Sleep(Nanosecond)
}
}()
c := Tick(1)