小宇轩
2015-05-07 15:53
请教老师或各位朋友,这个wait(),yield(),notifyAll()的用法,到底什么时候用啊,用在哪里,完全不懂
wait()和notifyAll()是在线程同步的时候使用的一对方法。yield()通常而言你不会用到。一下来自Java API
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.
深入浅出Java多线程
186088 学习 · 464 问题
相似问题