阅读背景:

一段多线程锁机制的代码,看完你会提高不少。

来源:互联网 

最近看到一段很有意思的代码,先贴出来。

/** * * 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(); 休眠,



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: