平时还是比较喜欢看书的..但有时候遇到问题还是经常感到脑袋一蒙..智商果然是硬伤.. 同事发现了个问题,代码如下: class Program { static void Main(string[] args) { HttpClientClass c = new HttpClientClass(); while (true) { Task.Factory.StartNew(() => { Console.WriteLine(Thread.CurrentThread.ManagedThreadId
=========================one============================= public class Bingfa { public static void main(String[] args) throws InterruptedException { // 锁住所有线程,等待并发执行 final CountDownLatch begin = new CountDownLatch(1);
public class CountDownLatchTest1 implements Runnable{ final AtomicInteger number = new AtomicInteger(); volatile boolean bol = false; @Override public void run() { System.out.println(number.getAndIncrement()); synchronized (this) { try { if (!bol) {