CountDownLatch,CyclicBarrier,Semaphore 使用
package com.pa.test.JUC.support;
import java.util.concurrent.CountDownLatch;
/**
* CountDownLatch 减法计数器
* 原理:
* countDownLatch.countDown(); //数量-1
* countDownLatch.await(); //执行等待 等待计数器归零,然后在向下执行
* 每次有线程调用countDownLatch.countDown()数量-1 ,当计数器为0 , co.
原创
2021-11-01 16:57:55 ·
65 阅读 ·
0 评论