aboutsummaryrefslogtreecommitdiff
path: root/src/sync
diff options
context:
space:
mode:
Diffstat (limited to 'src/sync')
-rw-r--r--src/sync/waitgroup_test.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/sync/waitgroup_test.go b/src/sync/waitgroup_test.go
index 4ab438cbab..c569e0faa2 100644
--- a/src/sync/waitgroup_test.go
+++ b/src/sync/waitgroup_test.go
@@ -147,7 +147,7 @@ func TestWaitGroupMisuse3(t *testing.T) {
}
}()
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(4))
- done := make(chan interface{}, 2)
+ done := make(chan interface{}, 3)
// The detection is opportunistically, so we want it to panic
// at least in one run out of a million.
for i := 0; i < 1e6; i++ {
@@ -171,8 +171,13 @@ func TestWaitGroupMisuse3(t *testing.T) {
}()
wg.Wait()
}()
- wg.Wait()
- for j := 0; j < 2; j++ {
+ go func() {
+ defer func() {
+ done <- recover()
+ }()
+ wg.Wait()
+ }()
+ for j := 0; j < 3; j++ {
if err := <-done; err != nil {
panic(err)
}