Re: Threads



Tristan Van Berkom wrote:

On Thu, 16 Dec 2004 02:47:50 +1100, Russell Shaw <rjshaw netspace net au> wrote:
So if g_main_loop_run() runs for the duration of the app, then there is nothing
guarding gdk calls made by gtk callbacks. So, doesn't this mean that every gtk
operation in a gtk callback that eventually calls a gdk function, should be
surrounded by gdk_threads_enter()/leave() ?

Callbacks that you register with widgets run outside the threads mutex,
so yes; you should protect gtk/gdk function calls with
gdk_threads_enter()/leave().

No, all callbacks from GTK widgets run in the lock, so if you will try to lock a global mutex in any signal handler you'll get nothing but deadlock. In MT app you should protect timeout and idle callbacks only (and, of course, the code from another threads that use any GTK/GDK function or data).

   Olexiy




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