Re: GTK and threads

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

 



Hi,

"Vlietstra, Joe (NSSD)" <Joe.Vlietstra@xxxxxxx> writes:

> 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?

Have a look at gtkmain.c. The lock is (of course) released while the
main loop is being run.


Sven
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux