RE: JavaMemoryModel: Question about _current_ semantics of start

From: Boehm, Hans (hans_boehm@hp.com)
Date: Tue Jun 13 2000 - 20:22:35 EDT


> -----Original Message-----
> x = 1;
> Thread t = new Thread();
> y = 2;
> t.start();
>
> The other issue with David's discussion is that it does not
> address code
> movement made by the compiler. Do compilers need to treat
> Thread.start as
> something special? Would it be cleaner to treat any "new" as something
> special? Does one or the other cause implementers more grief?
>
No. The compiler has to go out of its way to move the y=2 assignment past
the t.start() call,
since that requires the knowledge that t.start() doesn't itself call
something that accesses y.
It seems to me that the compiler has to work really hard here to get the
unexpected result.

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



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