java.util.concurrent.CountDownLatch 的实现是否可以处理向上递增初始计数?
Is the an implementation of java.util.concurrent.CountDownLatch which can handle incrementing the initial count upward?
我需要一个 java.lang.Thread 来等待不可预测数量的前置线程完成,作为一个 "choke point",然后再释放另一批线程的生成。如果有 countUp 和 countDown 的方法,CountDownLatch 似乎会起作用。
有这样的实现吗,还是需要自己实现信号量奇点?
A reusable synchronization barrier, similar in functionality to CyclicBarrier and CountDownLatch but supporting more flexible usage.
Unlike the case for other barriers, the number of parties registered to synchronize on a phaser may vary over time. Tasks may be registered at any time . . . and optionally deregistered upon any arrival
我需要一个 java.lang.Thread 来等待不可预测数量的前置线程完成,作为一个 "choke point",然后再释放另一批线程的生成。如果有 countUp 和 countDown 的方法,CountDownLatch 似乎会起作用。
有这样的实现吗,还是需要自己实现信号量奇点?
A reusable synchronization barrier, similar in functionality to CyclicBarrier and CountDownLatch but supporting more flexible usage.
Unlike the case for other barriers, the number of parties registered to synchronize on a phaser may vary over time. Tasks may be registered at any time . . . and optionally deregistered upon any arrival