From e0aa26a42719f8eae1cbf64349f3bee24a42e2a2 Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Fri, 18 Jan 2013 15:31:01 +1100 Subject: [PATCH] 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 --- src/pkg/time/sleep_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) -- 2.48.1