摘要:
调用LockSupport.park()会阻塞当前的线程,LockSupport.unPark()会唤醒当前线程 public class ParkAndUnPark { public static void main(String[] args) { MyThread1 thread1 = new 阅读全文
摘要:
Java当中的 ++i 和 i++都是线程非安全的 以下多线程方式自增100得到的结果并不是100 public class Test { public static int num = 0; public void increase(){ try { Thread.sleep(300); }cat 阅读全文