CyclicBarrier class is a synchronization mechanism that
can synchronize threads progressing through some algorithm. In other words, it
is a barrier that all threads must wait
at, until all threads reach it, before any of the threads can continue.
Here is a diagram illustrating that:
Two threads waiting for each other
at CyclicBarriers.
|
The threads wait for
each other by calling the await() method
on the CyclicBarrier. Once N threads are waiting at the CyclicBarrier, all
threads are released and can continue running.
No comments:
Post a Comment