Blogger

Delete comment from: Javarevisited

Unknown said...

"..You can use CyclicBarrier in Java :
1) To implement multi player game which can not begin until all player has joined."

While I can see how one might be able to use a CyclicBarrier for the multi player example, a CountDown latch is actually more relevant here. Latches are precisely meant for this use - a one off event where some control thread wants to wait for N number of other threads before proceeding. As a matter of fact, that specific example (the multi-player example) is used in the Java concurrency in Practice book (5.5.1).

Dec 29, 2013, 1:33:55 PM


Posted to What is CyclicBarrier in Java? How and When to use CyclicBarrier with Example? Tutorial

Google apps
Main menu