[Gtk-sharp-list] A better interface for invoking on the UI thread.

Doug Blank doug.blank at gmail.com
Tue Oct 9 18:38:17 UTC 2012

On Tue, Oct 9, 2012 at 3:18 AM, Daniel Hughes <trampster at gmail.com> wrote:
> Yes the first call to Invoke will call Application.Invoke regardless.
> However incurring a single extra invoke in the lifetime of your app is not
> much of a problem.

I thought I had the case where I tried to do an invoke when I was
already in the Graphics thread, and that caused problems. But I was
having many issues, so perhaps I am mistaken.

> I do like your idea of having a initialize invoke method but you will have
> to remember to call it when you start your app.

Yes, it is nice not to have to think about it.


> Cheers,
> Daniel Hughes
> On Tue, Oct 9, 2012 at 3:25 AM, Doug Blank <doug.blank at gmail.com> wrote:
>> On Mon, Oct 8, 2012 at 5:19 AM, Daniel Hughes <trampster at gmail.com> wrote:
>> > Hi guys,
>> >
>> > I have done a blog post detailing the method I use for invoking on the
>> > UI
>> > thread in widemargin in the hope that others might find it useful. You
>> > can
>> > read it here:
>> >
>> >
>> > http://trampster.blogspot.co.nz/2012/10/invoking-on-ui-thread-in-gtk.html
>> Brilliant! I had also developed the same as keeping track of the
>> thread and invoking when needed, but adding it as an Extension Method
>> to the Gtk.Widget is a great idea.
>> One question: in the initial call of RevokeRequired, won't the
>> Application.Invoke get sent off to the GUI thread, and thus the return
>> value will be wrong because the setting of _uiThread won't have
>> completed yet? or am I mistaken?
>> I guess you could have a special InitializeRevoke. BTW, We have found
>> that the GUI thread is always the same (0 or 1, I forget). I wonder if
>> that will always be the case?
>> Thanks for sharing!
>> -Doug
>> > _______________________________________________
>> > Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
>> > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>> >

More information about the Gtk-sharp-list mailing list