Skip to content

Commit

Permalink
Update worker.go
Browse files Browse the repository at this point in the history
调整
  • Loading branch information
ggkcoding committed Sep 25, 2024
1 parent 9c983b9 commit 4d80af8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions async/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ func (ac *worker) Add(fn func()) {
})
}

// Add 添加异步执行的方法
func (ac *worker) AddGO(fn func()) {
ac.wg.Add(1)
go func() {
ac.executeFunc(fn)
}()
}

func (ac *worker) executeFunc(fn func()) {
defer func() {
// 异常处理
Expand Down

0 comments on commit 4d80af8

Please sign in to comment.