Re: JavaMemoryModel: fusing synch blocks

From: Doug Lea (dl@cs.oswego.edu)
Date: Sat Feb 03 2001 - 09:10:42 EST


> According to the JMM,
> Thread.interrupted() has to employ either a volatile or a synch, right?

Yes, but ...

> I think Doug's Thread.interrupted() example of when not to fuse is already
> handled by the rules for synchs and volatiles.

... As far as I can see, interruption could be implemented
to fall within the pattern of my original example:

             T1 T2
           for (;;) { synchronized(x) { a = 1; }
             synchronized(x) {
               if (a != 0) break;
             }
           }

where:
   x is the Thread,
   a is the thread's interrupt status
   Thread.isInterrupted() is implemented as (a != 0)
   Thread.interrupt is implemented as a = 1; (plus other stuff it might do)

-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:29 EDT