1 2 3 4 5 6 7 8 9 10 11 12 13 14 | synchronized (lock1) { // lock1 is defined in the "Methods and Static Variables" tab Thread.sleep(5000); ThreadMonitor.registerThreadStatus("blocked"); synchronized (lock2) { ThreadMonitor.registerThreadStatus("running"); } } synchronized (lock1) { // lock2 is defined in the "Methods and Static Variables" tab Thread.sleep(5000); ThreadMonitor.registerThreadStatus("blocked"); synchronized (lock2) { ThreadMonitor.registerThreadStatus("running"); } } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |