]> Cypherpunks repositories - gostls13.git/commitdiff
time: Sleep does better job then runtime.Gosched in TestAfterStress
authorAlex Brainman <alex.brainman@gmail.com>
Fri, 18 Jan 2013 04:31:01 +0000 (15:31 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Fri, 18 Jan 2013 04:31:01 +0000 (15:31 +1100)
for slow windows-386 builder

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/7128053

src/pkg/time/sleep_test.go

index 3e4b6c072c5d7b03d8ceb2be8efce23a72096b64..6671eb317d38a423200392c7b9d41808cd77c4f1 100644 (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)