Re: JavaMemoryModel: Problem with Thread.sleep

From: Bill Pugh (pugh@cs.umd.edu)
Date: Mon Oct 25 1999 - 14:43:37 EDT


>
>Egats, I understand the current JMM has a problem with immutable objects,
>"IF" immutable objects were garunteed to be immutable, this would work. I
>believe (hope) a new memory model will fix this. Otherwise I believe that
>synchronization is not nescessarily nescessary for a "correct" hashtable
>with limited functionality.
>

For your code, these is also the factor that there isn't anything
that requires that a thread _ever_ see any of the writes by any other
thread.

In this case, that is valid. But it would be nice to see some of the
writes by other threads, even if we don't make any guarantees about
the promptness of that. The only way to do that is through
synchronization or a volatile field.

        Bill

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



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