Re: thread support in Windows: problem



On Thu, 2008-01-24 at 21:26 +0100, fkater googlemail com wrote:
I've tried to make gtk work with threads on win32 and linux for a long 
time now and I am finally proud to say, it is possible -- but, as Tor 
said, not trivial.
[snip]
Write wrapper functions for any gtk operation you'd like to execute from
threads in a way that the thread calls a glib's idle function which does
the real gtk work. Additionally (!) you need to lock gtk/gdk access by 
the gds_threads_enter/leave functions -- since idle functions are not
auto-locked by gtk (like signals are).

It's pointless calling gdk_threads_enter()/leave() in windows because it
won't work.  It's also unnecessary in your use because the callback for
g_idle_add() executes in the GTK+ main loop and not in the calling
thread - which is fine, and works well.

So your approach is correct, except as regards the need to call
gdk_threads_enter()/leave().

Chris





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]