[Glade-users] glade and thread-safe code...



Roberto Diaz wrote:

Hi!

I've been using glade to build my GUI.. but my application must be
multi-threaded.. I'm having a real nightmare finding out whethert gtk+ is
really thread safe or is not.. but the worst problem..

�How can I tell glade that my application will be multi-threaded so it
builds the correct makefile?

GTK+ has a global lock which you must get with GDK_THREADS_ENTER
before calling any GTK+ code. (And release with GDK_THREADS_LEAVE.)
I think GLib is thread-safe - it handles any locking needed itself.
I think people normally keep all GUI code in one thread and use other
threads for background tasks etc.


If you are developing a GTK+ app (i.e. you disabled Gnome support)
you just need to change this line in the configure.in:

AM_PATH_GTK(1.2.0, ,
            AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?))

to:

AM_PATH_GTK(1.2.0, ,
            AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?), gthread)


For a Gnome app I'm not so sure. I think if you replace the line in configure.in:

GNOME_X_CHECKS

with:

AM_PATH_GTK(1.2.0, ,
            AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?), gthread)

it will probably work.


Anyone know any better?

Damon







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