Skip to content

Commit

Permalink
feat: add taskcount() for gopool
Browse files Browse the repository at this point in the history
Signed-off-by: rfyiamcool <[email protected]>
  • Loading branch information
rfyiamcool committed Oct 8, 2023
1 parent 614d0af commit 9031d89
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions util/gopool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,16 @@ func (p *pool) SetPanicHandler(f func(context.Context, interface{})) {
p.panicHandler = f
}

// WorkerCount get worker count
func (p *pool) WorkerCount() int32 {
return atomic.LoadInt32(&p.workerCount)
}

// TaskCount get task count
func (p *pool) TaskCount() int32 {
return atomic.LoadInt32(&p.taskCount)
}

func (p *pool) incWorkerCount() {
atomic.AddInt32(&p.workerCount, 1)
}
Expand Down

0 comments on commit 9031d89

Please sign in to comment.