如題,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
提交
取消