@Test public void testPark() { Thread thread = new Thread(() -> { out.println("启动测试"); LockSupport.park(); out.println("unpack了"); }); thread.start(); LockSupport.parkNanos(TimeUnit.SECONDS.toNanos(6)); LockSupport.unpark(thread); }
public static void park(Object blocker) { Thread t = Thread.currentThread(); setBlocker(t, blocker); UNSAFE.park(false, 0L); setBlocker(t, null); }
LockSupport { public static void park(Object blocker) { Thread t = Thread.currentThread(); setBlocker(t, blocker); UNSAFE.park(false, 0L); setBlocker(t, null); } }
LockSupport { public static void park(Object blocker) { Thread t = Thread.currentThread(); setBlocker(t, blocker); UNSAFE.park(false, 0L); setBlocker(t, null); } private  LockSupport(); }
LockSupport { public static void park(Object blocker) { Thread t = Thread.currentThread(); setBlocker(t, blocker); UNSAFE.park(false, 0L); setBlocker(t, null); } private  LockSupport(); static void unpark(Thread thread); static void park(Object blocker); static void parkNanos(Object blocker, long nanos); static void parkUntil(Object blocker, long deadline); static Object getBlocker(Thread t); static void park(); static void parkNanos(long nanos); static void parkUntil(long deadline); }
LockSupport { public static void park(Object blocker) { Thread t = Thread.currentThread(); setBlocker(t, blocker); UNSAFE.park(false, 0L); setBlocker(t, null); } private  LockSupport(); static void unpark(Thread thread); static void park(Object blocker); static void parkNanos(Object blocker, long nanos); static void parkUntil(Object blocker, long deadline); static Object getBlocker(Thread t); static void park(); static void parkNanos(long nanos); static void parkUntil(long deadline);  }