test/fixedbugs/issue19467.dir/mysync.go
raw| 1 | // Copyright 2017 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package mysync |
| 6 | |
| 7 | import "runtime" |
| 8 | |
| 9 | type WaitGroup struct { |
| 10 | Callers []uintptr |
| 11 | } |
| 12 | |
| 13 | func (wg *WaitGroup) Add(x int) { |
| 14 | wg.Callers = make([]uintptr, 32) |
| 15 | n := runtime.Callers(1, wg.Callers) |
| 16 | wg.Callers = wg.Callers[:n] |
| 17 | } |
| 18 | |
| 19 | func (wg *WaitGroup) Done() { |
| 20 | wg.Add(-1) |
| 21 | } |