[Mono-dev] COM, Threads and Mono
Robert Jordan
robertj at gmx.net
Fri Sep 2 14:28:13 EDT 2011
On 02.09.2011 19:59, Alan wrote:
> The System.Windows.Forms sync context runs stuff on the winforms main loop,
> so wouldn't it be prone to exactly the message pumping related deadlocks
> that were already described?
Well, not more deadlock prone than providing a callback and
hoping that the consumer will be magically preventing
deadlocks.
If you look at the bug entry
https://bugzilla.novell.com/show_bug.cgi?id=672879
you'll find out that Tom wanted to use Application.Idle,
the MWF message pump, for this purpose.
Robert
>
> Alan
>
> On 2 September 2011 18:30, Robert Jordan<robertj at gmx.net> wrote:
>
>> Hi Jonathan,
>>
>> How about relying on System.Threading.SynchronizationContext.Current?
>> This could work w/out exposing any internal calls/env vars.
>>
>> This way we offload the burden of implementing a suitable
>> SynchronizationContext on the COM consumer. Done ;)
>>
>> The necessary runtime changes are as simple as this:
>>
>> ~__ComObject ()
>> {
>> SynchronizationContext.Current.Post(delegate {
>> ReleaseInterfaces ();
>> });
>> }
>>
>> Consumers publish their own SynchronizationContext with
>> SynchronizationContext.SetSynchronizationContext(
>> new MySuperCoolSyncContext());
>>
>> Robert
>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
More information about the Mono-devel-list
mailing list