tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 49972] Double-check idiom. Possible data-race.
Date Wed, 22 Sep 2010 16:53:50 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=49972

--- Comment #6 from Chuck Caldarale <chuck.caldarale@unisys.com> 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: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message