最近看到一段很有意思的代码,先贴出来。
/** * * sleep(); 休眠,不会丢失任何监视器的所有权 * wait(); 等待,释放对监视器的所有权 * notice(); Wakes up a single thread that is waiting on this object's monitor * notifyAll(); Wakes up all threads that are waiting on this object's monitor. * synchronized: 加锁同步,实际上就是并行执行串行化 */** * * sleep(); 休眠,