GTK and threads



Our group has previously written several multithreaded GTK applications.
We had a problem with a new application, investigated, read the API docs,
and now we are completely confused about GTK threads.

The example applications in the API documentation contain the following
code snippet:
   gdk_threads_enter();
   gtk_main();
   gdk_threads_leave();
gdk_threads_enter() is simply a wrapper function that locks the
gdk_threads_mutex.  Similarly, gdk_threads_leave() is a wrapper that
unlocks the mutex.  This means GTK main loop has a lock on the mutex
and apparently holds this lock until the main loop exits.  If GTK main
is always holding the mutex, how can other threads acquire the lock?

Related question.  This is a GTK/WIN32 application built on GTK v2.4.13
using installer from gladewin32.sourceforge.net.  Are there problems
with GTK threads on WIN32 that we should be aware of?  Couldn't find
any applicable bug reports in bugzilla.gnome.org.

Thanks,
Joe Vl



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