]> Cypherpunks repositories - gostls13.git/commit
sync: improve race instrumentation of WaitGroup
authorDmitriy Vyukov <dvyukov@google.com>
Mon, 10 Jun 2013 18:38:58 +0000 (22:38 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Mon, 10 Jun 2013 18:38:58 +0000 (22:38 +0400)
commit0f4897ae1a99d5c9de78c33c7b0963e71960c678
tree4fe452ff80c7e28f264fb59c1d5b594a5d923713
parented6dce6f9d5bfb109b46a11f6843f8391abb8678
sync: improve race instrumentation of WaitGroup
Do not synchronize Add(1) with Wait().
Imitate read on first Add(1) and write on Wait(),
it allows to catch common misuses of WaitGroup:
- Add() called in the additional goroutine itself
- incorrect reuse of WaitGroup with multiple waiters

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/10093044
src/pkg/runtime/race/testdata/waitgroup_test.go
src/pkg/sync/race.go
src/pkg/sync/race0.go
src/pkg/sync/waitgroup.go