From: Alex Brainman Date: Fri, 18 Jan 2013 04:31:01 +0000 (+1100) Subject: time: Sleep does better job then runtime.Gosched in TestAfterStress X-Git-Tag: go1.1rc2~1367 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e0aa26a42719f8eae1cbf64349f3bee24a42e2a2;p=gostls13.git 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 --- diff --git a/src/pkg/time/sleep_test.go b/src/pkg/time/sleep_test.go index 3e4b6c072c..6671eb317d 100644 --- a/src/pkg/time/sleep_test.go +++ b/src/pkg/time/sleep_test.go @@ -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)