1
0
mirror of https://github.com/golang/go synced 2024-11-23 07:10:05 -07:00

sync: don't assume b.N > 0

Change-Id: I6eb91ea73ef887b025e5a8de1dd55f30618e1aa6
Reviewed-on: https://go-review.googlesource.com/20857
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Marcel van Lohuizen 2016-03-18 17:16:56 +01:00
parent a5cd53a9fd
commit f693015be6

View File

@ -25,6 +25,9 @@ func BenchmarkSemaUncontended(b *testing.B) {
}
func benchmarkSema(b *testing.B, block, work bool) {
if b.N == 0 {
return
}
sem := uint32(0)
if block {
done := make(chan bool)