-
Notifications
You must be signed in to change notification settings - Fork 369
-
Notifications
You must be signed in to change notification settings - Fork 369
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
条件变量例子中的条件判断问题 #3
Comments
赞,小程序只为了做个demo演示一下能力,你能发个PR吗? |
好的 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
examples/module2/condition/main.go
中的队列Dequeue
方法中,使用if
进行条件检查:建议改成使用
for
循环判断,避免多线程的情况下Wait()
返回时条件已经变化:例子中执行
Dequeue
的 goroutine 只有一个因此没有影响,本地试了下改成3个 goroutine 时就会出问题:The text was updated successfully, but these errors were encountered: