fix shutdown stuck or panic

This commit is contained in:
yusing
2025-01-03 03:08:21 +08:00
parent 9f71fc2dd5
commit ba8705fb84
3 changed files with 12 additions and 8 deletions

View File

@@ -30,9 +30,12 @@ func RootTask(name string, needFinish ...bool) *Task {
}
func newRoot() *Task {
t := &Task{name: "root"}
t := &Task{
name: "root",
childrenDone: make(chan struct{}),
finished: make(chan struct{}),
}
t.ctx, t.cancel = context.WithCancelCause(context.Background())
t.callbacks = make(map[*Callback]struct{})
return t
}