[Gtk-sharp-list] Help me with Invoke in Gtk
Michael Hutchinson
m.j.hutchinson at gmail.com
Mon Dec 18 10:49:37 EST 2006
On 12/18/06, White Spirit <wspirit at homechoice.co.uk> wrote:
> I recently did something very similar. I used a separate thread to
> receive messages and then called Application.Invoke so that the thread
> could safely place the received text in a TextView buffer.
There's a list of GTK# multithreading techniques at
http://mono-project.com/Responsive_Applications
My favourite is Gtk.Application.Invoke (delegate { /*anonymous
delegate code*/ }; )
No matter which thread you run this from, the code in the anonymous
delegate will run in the GTK# thread, so it can safely run GUI code.
The anonymous delegate can also capture variables from its surrounding
scope, though with the usual caveats of cross-threading.
--
Michael Hutchinson
http://mjhutchinson.com
More information about the Gtk-sharp-list
mailing list