如题,java thread yield 的设计目的是什么?有什么实际应用场景吗?Ps:它的作用是理解的,和 join 等的区别也理解。就是个人感觉这个设计有点鸡肋(可能是个人读书太少...)
2 回答
万千封印
TA贡献1891条经验 获得超3个赞
It is rarely appropriate to use this method. It may be useful for debugging or testing purposes, where it may help to reproduce bugs due to race conditions. It may also be useful when designing concurrency control constructs such as the ones in the java.util.concurrent.locks package.
你基本找不到用它的时候。
添加回答
举报
0/150
提交
取消
