Kaypler

站在大漠之巅,孤独凝望,远去的海市蜃楼,何时重现当年断壁残垣上的幻灭诗歌。

多线程死锁示例

/*死锁的常见现象:同步嵌套*/

class Test implements Runnable

{

private boolean flag;

Test(boolean flag){

this.flag = flag;

}

public void run(){

if(flag){

while(true)

synchronized(MyLock.locka){

System.out.println(Thread.currentThread().getName()+"..if   locka....");

synchronized...

© Kaypler | Powered by LOFTER