[concurrency-interest] Enforcing ordered execution of critical sections?
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest