[Mono-dev] Thread shutdown hook patch

Paolo Molaro lupus at ximian.com
Wed Feb 11 09:55:26 EST 2009


On 02/09/09 Rodrigo Kumpera wrote:
> > The attached patch adds a new hook to allow threads to shutdown after the
> > GC finalizer has finished.
> > The motivation for it is to improve profiler's reliability at shutdown
> > time.
> >
> > The new callback notifies the thread when regular shutdown starts and gives
> > it a change to not
> > finish at this time.
> >
> > Later on the same callback is used to notify the thread that the last stage
> > in the shutdown sequence
> > has been reached and it must shutdown.
> >
> > The callback is per-thread as I don't want to have tools like the profiler
> > messing up with embedded users.

I think this instroduces too much complexity: since the API is public
we'd need to end up maintaining the semantics as they happen to be now.
It would be much clearer to have a flag on the thread that behaves
similarly to critical finalizers: the thread that has it set will be
destroyed as late as possible on shutdown.
As for the callback, the existing mono_profiler_thread_end () should be
enough: if it isn't we need to discuss how we can fix that instead of
adding yet another callback.

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better


More information about the Mono-devel-list mailing list