[concurrency-interest] StampedLock

Florian Binder java at java4.info
Fri Oct 12 13:14:49 EDT 2012


In the Point example at [1] is it really necessary that x and y are 
volatile?
As far as I understand it if sl.validate(stamp) is true there must have 
been hb(sl.unlockWrite(stamp), sl.tryOptimisticRead (stamp)) and 
therefore the writes must have been visible. If it is not true we can 
not use currentX and currentY anyway and therefore it does not matter if 
the writes to the fields were treated as two separate writes.
Or do I miss something?

[1]: 
http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166edocs/jsr166e/StampedLock.html

-Flo



Am 12.10.2012 18:29, schrieb Doug Lea:
> On 10/12/12 12:11, Aleksey Shipilev wrote:
>
>> Not particularly a usage experience, but semantics question. What are
>> the memory semantics of SL methods?
>
> The effects are exactly the same as for the corresponding methods 
> ReentrantReadWriteLock. They aren't fleshed out yet in the Javadoc
> because cases involving OptimisticReads resist simple characterization
> in JMMese. We'll find some way to do this, but in the mean time,
> hopefully you can be comforted that they do what anyone would expect :-)
>
> -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/20121012/740b5230/attachment.html>


More information about the Concurrency-interest mailing list