Re: JavaMemoryModel: Word tearing

From: Doug Lea (dl@altair.cs.oswego.edu)
Date: Thu Jan 03 2002 - 15:22:21 EST


> with funky volatile
> definitions to override it

Not my intent! I should have been more direct about the embedded
question/issue in my post. Which amounts to a corner case:

   Normally (according to proposed JSR-133 semantics) if you share an
   array across threads, you need to make it volatile (or synchronize
   use).

   But if you happen to know that no two threads will ever read/write
   to the same array cell, should you still declare it volatile?

My answer is yes.

The answer is motivated by underlying word-tearing issues, but
I think "yes" is a good answer in any case.

-Doug

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:37 EDT