📄 thread_holdslock.java
字号:
// Test that Thread.holdsLock() works.class Lock {}public class Thread_HoldsLock{ static Lock lock = new Lock(); public static void main(String args[]) throws InterruptedException { Thread_HoldsLock thl = new Thread_HoldsLock(); thl.check(); synchronized (lock) { thl.check(); } thl.check(); } public void check() { Thread this_thread = Thread.currentThread(); System.out.println(this_thread.holdsLock(lock)); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -