[Mono-devel-list] HasShutdownStarted race?
michi at zeroc.com
Fri Jun 3 00:11:07 EDT 2005
System.Environment.HasShutdownStarted is the officially recommended way
of protecting finalizers against accessing finalized objects
What worries me is that I'm not sure this is free from race conditions.
I can find nothing in the documentation that would guarantee that the
condition cannot change halfway through the execution of a finalizer,
for example, if System.Environment.Exit() is called from another thread.
The only way this would be possible would be for the GC and Exit()
to interlock on setting HasShutDownStarted to true, so that the value
of the property cannot change halfway through the execution of a finalizer.
But, as far as I can see, that's not happening in the code.
Comments, anyone? Is this a potential bug?
More information about the Mono-devel-list