@@ -75,8 +75,14 @@ func NewGlobalWaitGroup(ctx context.Context) *globalWaitGroup {
}
func (this *globalWaitGroup) SetContext(ctx context.Context) {
- this.ctx = ctx
+ this.ctx, _ = context.WithCancel(ctx)
+
+func (this *globalWaitGroup) Stop() {
+ this.isStop = true
+ this.Wait()
+}
func (this *globalWaitGroup) Wait() {
go func() {
this.wait()