[concurrency-interest] ReentrantReadWriteLock sample usage - redundant volatile

Jörg Hettel joerg.hettel at hs-kl.de
Wed Dec 14 04:00:08 EST 2016

|In this case cacheValid field should also be changed to private|


Am 13.12.2016 um 22:08 schrieb Doug Lea:
> On 12/12/2016 03:55 PM, Roman Leventov wrote:
>> It seems that in "CachedData" sample usage in ReentrantReadWriteLock
>> class-level Javadoc comment volatile on cacheValid field is redundant,
>> because cacheValid is only accessed when readLock or writeLock is held,
>> that should guarantee total memory safety.
> Thanks; changed. Omitting "volatile" here might reduce confusion.
> My vague recollection is that the example was abstracted from
> an actual usage, where there may have been some reason to rely on
> volatile in other parts of the code.
> -Doug
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20161214/98f8ad18/attachment.html>

More information about the Concurrency-interest mailing list