[Gtk-sharp-list] Multi-threading and GTK#

Phil Durand draek@shaw.ca
Mon, 19 Jul 2004 16:46:12 -0600

I know this topic has been spoken about before, but I wanted to start
off by getting clarification of Gdk.Threads.

Our application has two parts, a library and a GTK# app. The library
uses System.Net to work with socket connections to a server. It obtains
its information through the use of timers and threads to provide a
non-blocking interface (we find that async io is not working correctly
in mono, so we have reverted to using this method, besides, we already
use timer threads so we dont evade threads by using async io)

Now, so far, I have been using Gdk.Threads.Init(); at the start of my
program, and Gdk.Threads.Enter() and Leave() between code blocks that
modify things in the UI to keep it thread safe. However, I am now at an
impass where the whole GTK# interface freezes when trying to modify a
TextView. I am assuming that I am experiencing a GTK# problem because of

Is Gdk.Threads.Enter/Leave() a solution to the threading issues with
GTK? or is it that I've just gotten lucky so far and Enter/Leave dont
actually do anything?

I've had lots of discussions about how to do multi-threading GTK# and to
be honest, I havent really come up with any good solutions other than
Enter/Leave from Gdk.Threads. Any information on this topic would be
greatly appreciated.

Thank you,
Phil Durand