Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #2691
| Date | 2011-03-31 22:24 -0700 |
|---|---|
| From | Patricia Shanahan <pats@acm.org> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: AtomicReferenceArray writes and visibility |
| References | <in14ae$qap$1@Gaia.teknon.de> <in3jv4$1so$1@dont-email.me> <eL6dnXcySPvzxwjQnZ2dnUVZ_q2dnZ2d@posted.palinacquisition> <in3m1d$pb9$1@dont-email.me> |
| Message-ID | <5rSdnZ3R1d8O_AjQnZ2dnUVZ_qWdnZ2d@earthlink.com> (permalink) |
On 3/31/2011 9:58 PM, markspace wrote: > On 3/31/2011 9:54 PM, Peter Duniho wrote: >> On 3/31/11 9:22 PM, markspace wrote: >>> [...] >>> Read the source code for the AtomicReferenceArray. set() doesn't use any >>> synchronization. It calls sun.misc.Unsafe#putObjectVolatile(). I don't >>> see how that's going to create a happens-before. >> >> "volatile" creates the happens-before. All writes before a volatile >> write in the same thread must be visible in a given thread after a >> volatile read in the same thread from the same location. > > > I didn't notice the keyword volatile there. Did I miss it? The relevant use of "volatile" is in the java.util.concurrent.atomic package documentation, http://download.oracle.com/javase/6/docs/api/java/util/concurrent/atomic/package-summary.html "The memory effects for accesses and updates of atomics generally follow the rules for volatiles, as stated in The Java Language Specification, Third Edition (17.4 Memory Model):" It goes on to map atomic operations to volatile operations. For example "get has the memory effects of reading a volatile variable." > Regardless, the lack of any guarantees in the docs of > AtomicReferenceArray would kill it for me. You can't be sure how the > implementation will change over time. Does that include the guarantees that it provides indirectly, by reference to the package documentation? Patricia
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
AtomicReferenceArray writes and visibility v_borchert@despammed.com (Volker Borchert) - 2011-03-31 05:43 +0000
Re: AtomicReferenceArray writes and visibility Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-03-31 00:52 -0700
Re: AtomicReferenceArray writes and visibility v_borchert@despammed.com (Volker Borchert) - 2011-04-02 06:28 +0000
Re: AtomicReferenceArray writes and visibility Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2011-03-31 20:55 -0700
Re: AtomicReferenceArray writes and visibility markspace <-@.> - 2011-03-31 21:22 -0700
Re: AtomicReferenceArray writes and visibility Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-03-31 21:54 -0700
Re: AtomicReferenceArray writes and visibility markspace <-@.> - 2011-03-31 21:58 -0700
Re: AtomicReferenceArray writes and visibility Patricia Shanahan <pats@acm.org> - 2011-03-31 22:24 -0700
Re: AtomicReferenceArray writes and visibility markspace <-@.> - 2011-03-31 22:55 -0700
Re: AtomicReferenceArray writes and visibility Lew <lew@lewscanon.com> - 2011-04-01 11:40 -0700
csiph-web