threadpool icon indicating copy to clipboard operation
threadpool copied to clipboard

Close func may cause a panic

Open PursuingPing opened this issue 2 years ago • 1 comments

//TODO: need to check the existing /running task before closing the threadpool

PursuingPing avatar Sep 17 '23 14:09 PursuingPing

And the threadPool close func has a problem in this scenario if the close func is called and the theaterPool is closed and thecase job := <-w.jobChannel:at the same time, the return select case may not be picked, so next for range will execute and the worker still can send to the worker channel, and it will panic. image

image

PursuingPing avatar Sep 17 '23 16:09 PursuingPing