]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/testing/benchmark.go
[dev.fuzz] all: merge master (d137b74) into dev.fuzz
[gostls13.git] / src / testing / benchmark.go
index ac22ac5b2674331b1b5e27b903090c414e4c6948..c8571a5f5a77427bf4343b092d4f37b36dd2e137 100644 (file)
@@ -238,12 +238,15 @@ func (b *B) run1() bool {
        }
        // Only print the output if we know we are not going to proceed.
        // Otherwise it is printed in processBench.
-       if atomic.LoadInt32(&b.hasSub) != 0 || b.finished {
+       b.mu.RLock()
+       finished := b.finished
+       b.mu.RUnlock()
+       if atomic.LoadInt32(&b.hasSub) != 0 || finished {
                tag := "BENCH"
                if b.skipped {
                        tag = "SKIP"
                }
-               if b.chatty != nil && (len(b.output) > 0 || b.finished) {
+               if b.chatty != nil && (len(b.output) > 0 || finished) {
                        b.trimOutput()
                        fmt.Fprintf(b.w, "--- %s: %s\n%s", tag, b.name, b.output)
                }