[Gtk-sharp-list] Problem with threaded GTK# Application on Windows

Mike Kestner mkestner at gmail.com
Mon Feb 23 10:41:02 EST 2009


On Mon, 2009-02-23 at 05:44 -0800, Rapha222 wrote:

> GTK is thread safe, so you can't to modify Gtk Widgets from another thread
> that the thread which is running the MainLoop (Application.Run()), unless if
> you use Thread.Enter() and Thread.Leave() to stop the mainloop during the
> modifications.

I had a conversation about this with one of the gtk+ win32 hackers.  The
Enter/Leave mechanism does not work on win32.  This is an underlying
issue in the win32 port of gtk+, which I believe is on the TODO list,
though non-trivial.

So bottom line, it's better to dispatch to the gui thread using
Application.Invoke, especially in the case of cross-platform
applications.

-- 
Mike Kestner <mkestner at gmail.com>



More information about the Gtk-sharp-list mailing list