B
Bob Johnson
In order to avoid a race condition a recommendation that makes a lot of
sense has been put forth.... create a local copy of the event handler
delegate, then test and invoke the copy, like this:
MyEventHandler hCopy = MyEvent;
if hCopy != null)
{
hCopy (this, myEventArgs)
}
But that's not good enough, according to the following blog (fairly brief
entry)...
http://blogs.msdn.com/jaybaz_ms/archive/2004/09/16/230681.aspx
.... because - as you can read there - the JITer may under some circumstances
optimize locals out of existance.
My question: How much validity would any of you place in the above claim
(JITer may optimize locals out of existance)? It's hard to believe that such
a thing could happen in the JITer (i.e., it overrides your coded logic) -
but considering the source... is there any validity to the claim?
The guy's recommended solution seems like a total hack.
I'd appreciate your thoughtful feedback on the above link and the issues and
solutions presented.
sense has been put forth.... create a local copy of the event handler
delegate, then test and invoke the copy, like this:
MyEventHandler hCopy = MyEvent;
if hCopy != null)
{
hCopy (this, myEventArgs)
}
But that's not good enough, according to the following blog (fairly brief
entry)...
http://blogs.msdn.com/jaybaz_ms/archive/2004/09/16/230681.aspx
.... because - as you can read there - the JITer may under some circumstances
optimize locals out of existance.
My question: How much validity would any of you place in the above claim
(JITer may optimize locals out of existance)? It's hard to believe that such
a thing could happen in the JITer (i.e., it overrides your coded logic) -
but considering the source... is there any validity to the claim?
The guy's recommended solution seems like a total hack.
I'd appreciate your thoughtful feedback on the above link and the issues and
solutions presented.