We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
考虑一个极端的例子 假设pool的容量为1
func (p *GoPool) Put(task *Task) error { if p.getState() == STOPED { return ErrPoolAlreadyClosed } p.Lock() if p.GetRunningWorkers() < p.GetCap() { p.run() } p.Unlock() //假设之前已经put了一个任务,要再put一个任务 //当程序执行到这里,如果之前put的任务突然panic了,其实,这时候没有可以执行任务的协程了 //下面的task发送不出去,并且之后也没有新的任务进来,就会永远阻塞这里。 p.Lock() if p.state == RUNNING { p.taskC <- task } p.Unlock() return nil }
会有这种情况吧
The text was updated successfully, but these errors were encountered:
fix issue #4
a0447b2
@shangxiaomi 感谢提出这个问题,已经修复到 release v1.5 中,现在 worker 结束后会检查是否没有可用 worker 确保至少有一个 worker 可以消费任务
Sorry, something went wrong.
No branches or pull requests
考虑一个极端的例子
假设pool的容量为1
会有这种情况吧
The text was updated successfully, but these errors were encountered: