tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 49972] Double-check idiom. Possible data-race.
Date Wed, 22 Sep 2010 16:53:50 GMT

--- Comment #6 from Chuck Caldarale <> 2010-09-22 12:53:46
EDT ---
(In reply to comment #4)
> > The simple fix is to just reverse these two lines:
> I afraid, it won't work. 
> The compiler is free to reverse these lines back.

Not in this case, due to the possibility of the new operator throwing an
exception and the constraint specified in section 11.3.1:

"Exceptions are precise: when the transfer of control takes place, all effects
of the statements executed and expressions evaluated before the point from
which the exception is thrown must appear to have taken place. No expressions,
statements, or parts thereof that occur after the point from which the
exception is thrown may appear to have been evaluated."

If there were no possibility of an exception, your statement would be true.

> > the Java language spec requires operations to be 
> > visible to other threads in program order
> Does it? 

That's my interpretation of this statement in section 17.4:

"Each time the evaluation of thread t generates an inter-thread action, it must
match the inter-thread action a of t that comes next in program order."

All reads and writes of shared variables are inter-thread actions.

 - Chuck

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message