1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| package com.redisc;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.locks.LockSupport;
@Slf4j(topic = "c.Run") public class Run {
public static void main(String[] args) throws Exception { Thread t1 = new Thread(() -> { LockSupport.park(); log.debug("1"); }); t1.start();
new Thread(() -> { log.debug("2"); LockSupport.unpark(t1); }).start();
}
}
|