Re: JavaMemoryModel: Volatiles - where does SC work and PO doesn't?

From: Doug Lea (dl@cs.oswego.edu)
Date: Tue Nov 21 2000 - 20:08:31 EST


> I would also be interested in use of
> monitors where the SC is needed between volatiles and monitors,

See Joe Bowbeer's example from the OOPSLA workshop, posted at the end
of http://www.cs.umd.edu/~pugh/java/memoryModel/workshop/
And pasted here for convenience:

    Initially:
    volatile boolean stop = false;

    Thread 1:
    synchronized(this) {
            while (!stop) work();
            }

    Thread 2:
    stop = true;
    synchronized(this) {
            consumeWork();
            }

-- 
Doug Lea, Computer Science Department, SUNY Oswego, Oswego, NY 13126 USA
dl@cs.oswego.edu 315-341-2688 FAX:315-341-5424 http://gee.cs.oswego.edu/  
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



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