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 5package mysync 6 7import "runtime" 8 9type WaitGroup struct { 10 Callers []uintptr 11} 12 13func (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 19func (wg *WaitGroup) Done() { 20 wg.Add(-1) 21} 22