aboutsummaryrefslogtreecommitdiff
path: root/src/sync
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2017-08-21 22:23:14 +0200
committerDaniel Martí <mvdan@mvdan.cc>2017-08-29 20:57:41 +0000
commitfbc8973a6bc88b50509ea738f475b36ef756bf90 (patch)
treebec33b02e805593213b72d9908443131af909fe0 /src/sync
parent305fd9179d2199cd1bb64402405857d2f2d02478 (diff)
downloadgo-fbc8973a6bc88b50509ea738f475b36ef756bf90.tar.xz
all: join some chained ifs to unindent code
Found with mvdan.cc/unindent. It skipped the cases where parentheses would need to be added, where comments would have to be moved elsewhere, or where actions and simple logic would mix. One of them was of the form "err != nil && err == io.EOF", so the first part was removed. Change-Id: Ie504c2b03a2c87d10ecbca1b9270069be1171b91 Reviewed-on: https://go-review.googlesource.com/57690 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/sync')
-rw-r--r--src/sync/waitgroup.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/sync/waitgroup.go b/src/sync/waitgroup.go
index f266f7c2b9..2fa7c3e07e 100644
--- a/src/sync/waitgroup.go
+++ b/src/sync/waitgroup.go
@@ -63,13 +63,11 @@ func (wg *WaitGroup) Add(delta int) {
state := atomic.AddUint64(statep, uint64(delta)<<32)
v := int32(state >> 32)
w := uint32(state)
- if race.Enabled {
- if delta > 0 && v == int32(delta) {
- // The first increment must be synchronized with Wait.
- // Need to model this as a read, because there can be
- // several concurrent wg.counter transitions from 0.
- race.Read(unsafe.Pointer(&wg.sema))
- }
+ if race.Enabled && delta > 0 && v == int32(delta) {
+ // The first increment must be synchronized with Wait.
+ // Need to model this as a read, because there can be
+ // several concurrent wg.counter transitions from 0.
+ race.Read(unsafe.Pointer(&wg.sema))
}
if v < 0 {
panic("sync: negative WaitGroup counter")