]> Cypherpunks repositories - gostls13.git/commitdiff
time: fix test hang
authorDmitriy Vyukov <dvyukov@google.com>
Mon, 14 Nov 2011 19:31:39 +0000 (22:31 +0300)
committerDmitriy Vyukov <dvyukov@google.com>
Mon, 14 Nov 2011 19:31:39 +0000 (22:31 +0300)
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5374083

src/pkg/time/sleep_test.go

index dae7dfe8fb21c52db2b2dd647d6d5631414dedb9..4c4a079880a2ee16fa21eb11433b1f72d3e6165b 100644 (file)
@@ -54,6 +54,9 @@ 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()
                }
        }()
        c := Tick(1)