[concurrency-interest] Enforcing ordered execution of critical sections?

Peter Levart peter.levart at gmail.com
Sun Dec 14 12:11:26 EST 2014

On 12/14/2014 05:37 PM, Hanson Char wrote:
> Thanks, Peter.  I like your idea.  It seems both CountDownLatch and 
> Semaphore are viable options for implementing this use case.  Are you 
> aware of any performance difference one may have over the other (in 
> this case)?

I think they are both the same as they both use 
AbstractQueuedSynchronizer under the hood. But they are actually 
overkill for your use-case. You only ever synchronize between two 
threads at a time, so a "simplified" variant is possible (as shown in my 
previous mail). Simplified in the sense of state overhead - the 
performance should be comparable.

Regards, Peter

> Regards,
> Hanson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20141214/287fe158/attachment.html>

More information about the Concurrency-interest mailing list