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
worker.go中,executeTaskWithTimeout执行有超时限制的任务会死锁。
执行代码:
func main() { var errCount int32 pool := gopool.NewGoPool(100, gopool.WithTimeout(1*time.Second), gopool.WithErrorCallback(func(err error) { fmt.Println("get a error") atomic.StoreInt32(&errCount, 1) })) defer pool.Release() // 超时任务 // pool.AddTask(func() (interface{}, error) { // time.Sleep(2 * time.Second) // return nil, nil // }) // 不超时任务 pool.AddTask(func() (interface{}, error) { fmt.Println("run normal task") return nil, nil }) pool.AddTask(func() (interface{}, error) { fmt.Println("run normal task") return nil, nil }) pool.AddTask(func() (interface{}, error) { fmt.Println("run normal task") return nil, nil }) pool.Wait() fmt.Println("err count:", errCount) }
因为result的chan接收到值后,会在下面等待err的chan 消息,但是此时已经没有发送方了。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
worker.go中,executeTaskWithTimeout执行有超时限制的任务会死锁。
执行代码:
因为result的chan接收到值后,会在下面等待err的chan 消息,但是此时已经没有发送方了。
The text was updated successfully, but these errors were encountered: