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

Daniel Hughes trampster at gmail.com
Tue Oct 9 07:18:59 UTC 2012


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 do like your idea of having a initialize invoke method but you will have
to remember to call it when you start your app.

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
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20121009/e71e2d19/attachment.html>


More information about the Gtk-sharp-list mailing list