summaryrefslogtreecommitdiff
path: root/libgo/go/sync/waitgroup.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/sync/waitgroup.go')
-rw-r--r--libgo/go/sync/waitgroup.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/libgo/go/sync/waitgroup.go b/libgo/go/sync/waitgroup.go
index f266f7c2b97..2fa7c3e07ed 100644
--- a/libgo/go/sync/waitgroup.go
+++ b/libgo/go/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")