On Monday 12 November 2001 14:56, you wrote:
> On Mon, Nov 12, 2001 at 03:06:33PM -0500, Gianni Johansson wrote:
> > There are unlocked reads and writes of runningCount in several places. 
> > This looks like a race condition to me.  Remember that ++ and -- are not
> > guaranteed to be atomic.
>
> runningCount is volatile so you don't have to worry about ++ and --
Making an int volatile only guarantees that atomic operations will be 
consistent across multiple threads, but ++ and -- are not atomic operations.

http://groups.google.com/groups?q=%2Bjava+%2Batomic+%2Bvolatile+%22%2B%2B%22&hl=en&rnum=1&selm=Xqw97.79973%24JN6.14966702%40news1.rdc1.mi.home.com
http://forum.java.sun.com/thread.jsp?forum=31&thread=181961

-- 
Freesites
(0.3) freenet:MSK at SSK@enI8YFo3gj8UVh-Au0HpKMftf6QQAgE/homepage//
(0.4) freenet:SSK at npfV5XQijFkF6sXZvuO0o~kG4wEPAgM/homepage//

_______________________________________________
Devl mailing list
Devl at freenetproject.org
http://lists.freenetproject.org/mailman/listinfo/devl

Reply via email to