-
Notifications
You must be signed in to change notification settings - Fork 880
New issue
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
Pick 函数的规范实现 #54
Comments
有性能测试保证稳定和正确性么? |
参考的是 《Linux多线程服务端编程:使用muduo C++网络库》 第2.2 条件变量 |
如果你需要的话, 我把这本书的电子版发给你。 这边书的作者,说条件变量标准的正确实现只有这一种。 |
跟你的写法,具体的差别,我也不是很清楚 |
对于你不清楚的东西,还是写测试用例证明. 任何修改都要对使用者负责,不能让别人当小白鼠 |
你测试的结果是二次lock 性能会比一次lock 好? |
当时只是解决带缓冲channel在数量过多时会死锁问题,换用现在修改解决问题 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
更简洁的实现是
func (self *Pipe) Pick(retList *[]interface{}) (exit bool) {
self.listGuard.Lock()
defer self.listGuard.UnLock()
}
The text was updated successfully, but these errors were encountered: