ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > ZSTU-(2020-2021)-1 > student homework > 2018329621261李翔岚 >
homework7 Version 0
👤 Author: by 1079513613qqcom 2020-12-15 05:58:30
public class DieLock {

public static Object t1 = new Object();
public static Object t2 = new Object();

public static void main(String[] args){
new Thread(){
@Override
public void run(){
synchronized (t1){
System.out.println("Thread1 get t1");

try {
Thread.sleep(100);
}catch (Exception e){

}

synchronized (t2){
System.out.println("Thread2 get t2");
}
}
}
}.start();

new Threa

Please login to reply. Login

Reversion History

Loading...
No reversions found.