Re: GTK and threads
- From: Sven Neumann <sven gimp org>
- To: "Vlietstra, Joe (NSSD)" <Joe Vlietstra ngc com>
- Cc: gtk-list gnome org
- Subject: Re: GTK and threads
- Date: Sun, 27 Feb 2005 14:26:10 +0100
Hi,
"Vlietstra, Joe (NSSD)" <Joe Vlietstra ngc com> 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]