Well, I was going through the Java concurrency in practice, by Brian Goetz,
and found difficult to understand in different between CountDownLatch
and Cyclic Barriers
.
It's look like both are same except that cyclic barriers can be reused ?
The books says that:
Latches are waiting for events, barriers are waiting for other threads
This statement seems to be very confusing. Not sure if this is a misquote by the authors or it has a real meaning. Functionally they appear to be same and it isn't difficult to rewrite a better version of CountDownLatch which is re-usable with a method like reset().
Not sure of the practical life application of cyclic barriers over count down latches ?
Though looks similar to one of the questions already asked on this blog ( about latches and barriers ), but this questions strives to understand some other subtleties.