Skip to content

Commit

Permalink
simple code
Browse files Browse the repository at this point in the history
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
  • Loading branch information
hawkingrei committed Jan 3, 2023
1 parent f62832a commit b29e662
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions util/gpool/spmc/spmcpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,7 @@ func (p *Pool[T, U, C, CT, TF]) retrieveWorker() (w *goWorker[T, U, C, CT, TF])

// revertWorker puts a worker back into free pool, recycling the goroutines.
func (p *Pool[T, U, C, CT, TF]) revertWorker(worker *goWorker[T, U, C, CT, TF]) bool {
if capacity := p.Cap(); capacity > 0 && p.Running() > capacity && p.waitingTask.Load() == 0 {
return true
}
if p.IsClosed() {
if capacity := p.Cap(); capacity > 0 && p.Running() > capacity || p.IsClosed() {
p.cond.Broadcast()
return false
}
Expand Down

0 comments on commit b29e662

Please sign in to comment.