Hi guys,

is it possible to share an object between two *different write locks*,
and keep correct memory visibility?
That is, if thread T1 writes to object under lock W1, and *then*
thread T2 (say on another node) reads from object under lock W2, is it
guaranteed that T2 will see the updated T1 value?

The standard memory model doesn't make any guarantee due to the use of
different locks, so the problem would require a memory barrier or a
volatile field; however, I'd like to avoid memory barriers due to lock
hopping, and Terracotta AFAIK does not support volatile fields, so I
was wondering how to implement such a use case.
As a side note, LinkedBlockingQueue works just that way, and I was
indeed wondering how you get to cluster that ...

Thanks much,
Cheers,

Sergio B.

-- 
Sergio Bossa
Software Passionate and Open Source Enthusiast.
URL: http://www.linkedin.com/in/sergiob
_______________________________________________
tc-dev mailing list
tc-dev@lists.terracotta.org
http://lists.terracotta.org/mailman/listinfo/tc-dev

Reply via email to