[Mono-dev] About your changes to type initialization
Rodrigo Kumpera
kumpera at gmail.com
Tue Mar 9 13:35:42 EST 2010
On Tue, Mar 9, 2010 at 1:57 PM, Martin Baulig <martin at ximian.com> wrote:
> On 03/08/2010 08:24 PM, Rodrigo Kumpera wrote:
> >
> > Routing Thread::Abort() around is not the behavior I can observe on
> > MS. Do you have
> > any test or documentation that shows this behavior? Even if this looks
> > like the wrong
> > thing, we should follow MS behavior as compatibility is one of our
> > major goal.
> >
> > What we could do, thou, is to have this behavior as something our
> > debuggers can use.
>
> Hi Rodrigo,
>
> I attached a test case which blocks on MS, but doesn't in Mono.
>
> I tried this both with and without the Visual Studio debugger, and the
> `a.Abort ()' always
> blocks for 10 seconds till the second thread signaled the wait handle.
> The main thread's
> call to Test.Foo() then succeeds.
>
> When run with Mono, the `a.Abort ()' immediately aborts the thread and
> the subsequent
> `new Test ()' throws the TypeInitializationException.
>
>
Right, mono's behavior is really different from MS's.
>From what I can gather this is what it happens:
If aborting itself, is the same as doing "throw new ThreadAbortException ()"
and it does break protected blocks[1].
If aborting a thread that is executing a protected block, the caller blocks
until the aborted finishes it.
Those rules apply across appdomains. So if appdomain D0 abort thread T1
which is running a protected block in
another appdomain, it will block.
I'm working toward fixing this, but it will take a while given how insanely
complex this part of the runtime is.
[1]Protected blocks are catch, finally, filter, CER or .cctor.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100309/79b850a4/attachment-0001.html
More information about the Mono-devel-list
mailing list