]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove useless loop from CgoCCodeSIGPROF test program
authorIan Lance Taylor <iant@golang.org>
Wed, 15 Jun 2016 17:36:48 +0000 (10:36 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 16 Jun 2016 03:52:18 +0000 (03:52 +0000)
I verified that the test fails if I undo the change that it tests for.

Updates #14732.

Change-Id: Ib30352580236adefae946450ddd6cd65a62b7cdf
Reviewed-on: https://go-review.googlesource.com/24151
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
src/runtime/testdata/testprogcgo/aprof.go

index b4b71f28619f4260520ceb159b3f10556fa8d685..aabca9e1ebd978dfa4b4f2c8de789837da78e71c 100644 (file)
@@ -30,19 +30,17 @@ func GoNop() {}
 func CgoCCodeSIGPROF() {
        c := make(chan bool)
        go func() {
-               for {
-                       <-c
-                       start := time.Now()
-                       for i := 0; i < 1e7; i++ {
-                               if i%1000 == 0 {
-                                       if time.Since(start) > time.Second {
-                                               break
-                                       }
+               <-c
+               start := time.Now()
+               for i := 0; i < 1e7; i++ {
+                       if i%1000 == 0 {
+                               if time.Since(start) > time.Second {
+                                       break
                                }
-                               C.GoNop()
                        }
-                       c <- true
+                       C.GoNop()
                }
+               c <- true
        }()
 
        var buf bytes.Buffer