[Mono-bugs] [Bug 672879] ReleaseInterfaces is called by GC thread.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Sep 3 07:26:16 EDT 2011



--- Comment #16 from Robert Jordan <robertj at gmx.net> 2011-09-03 11:26:13 UTC ---
Tom, another small optimization:

private void InitializeApartmentDetails ()
single_thread_apartment = Thread.CurrentThread.GetApartmentState() ==
synchronization_context = SynchronizationContext.Current;
// Check whether the current context is a plain SynchronizationContext object
// and handle this as if no context was set at all.
if (synchronization_context != null &&
    synchronization_context.GetType () == typeof(SynchronizationContext))
    synchronization_context = null;

The idea behind is: the default SynchronizationContext is per spec a free
threaded one, but its Post() implementation is using the ThreadPool to invoke
the delegate so it doesn't block. We don't need this behavior.

This is only for the case that some consumer has set
SynchronizationContext.Current = new SynchronizationContext(). It seems that
Mono's WinForms is doing this during shutdown.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list