-
Notifications
You must be signed in to change notification settings - Fork 229
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
java-thread.md中的一个问题 #228
Comments
并且我不明白为什么会失效 |
没明白你说的失效是什么意思 |
就是代码运行起来并没有达到yield的效果,如果你去掉synchronized关键字就达到了yield的效果
|
是的,需要把synchronized去掉。加上synchronized关键字是可以测出来在同步方法中执行Thread.yeild()会不会起作用 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在 https://github.com/zhonghuasheng/Tutorial/blob/master/java/basic/java-thread.md#%E7%BA%BF%E7%A8%8B%E7%9A%84%E8%AE%A9%E6%AD%A5yeild
代码中Yield#call方法使用了synchronized导致Thread.yield()失效
The text was updated successfully, but these errors were encountered: