Implement a blocking function call in Java

前端 未结 3 711
-上瘾入骨i
-上瘾入骨i 2020-12-30 09:18

What is the recommended / best way to implement a blocking function call in Java, that can be later unblocked by a call from another thread?

Basically I want to have

3条回答
  •  渐次进展
    2020-12-30 09:45

    There are a couple of different approaches and primitives available, but the most appropriate sounds like a CyclicBarrier or a CountDownLatch.

提交回复
热议问题