[concurrency-interest] tryAcquire vs tryAcquireShared in ReentrantReadWriteLock

Khilan Gudka khilan at doc.ic.ac.uk
Tue Mar 16 17:07:18 EDT 2010


Dear all,

Please excuse me if this question is trivial but I was just wondering why
tryAcquireShared in ReentrantReadWriteLock uses a loop to deal with CAS
misses whereas tryAcquire just returns false. Is this because it's most
likely that the lock is now unavailable and would therefore save a loop
iteration?

Khilan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20100316/36e274ce/attachment.html>


More information about the Concurrency-interest mailing list