[concurrency-interest] ReentrantReadWriteLock sample usage - redundant volatile
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.
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest