1999-08-16 18:51:52 +00:00
|
|
|
<!-- ##### SECTION Title ##### -->
|
|
|
|
Threads
|
|
|
|
|
|
|
|
<!-- ##### SECTION Short_Description ##### -->
|
2001-10-17 21:41:47 +00:00
|
|
|
functions for using GDK in multi-threaded programs
|
1999-08-16 18:51:52 +00:00
|
|
|
|
|
|
|
<!-- ##### SECTION Long_Description ##### -->
|
|
|
|
<para>
|
2001-10-17 21:41:47 +00:00
|
|
|
For thread safety, GDK relies on the thread primitives in GLib,
|
|
|
|
and on the thread-safe GLib main loop.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
You must call g_thread_init() before executing any other GTK+ or GDK
|
|
|
|
functions in a threaded GTK+ program.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Idles, timeouts, and input functions are executed outside
|
|
|
|
of the main GTK+ lock. So, if you need to call GTK+
|
|
|
|
inside of such a callback, you must surround the callback
|
|
|
|
with a gdk_threads_enter()/gdk_threads_leave() pair.
|
|
|
|
(However, signals are still executed within the main
|
|
|
|
GTK+ lock.)
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
In particular, this means, if you are writing widgets that might
|
|
|
|
be used in threaded programs, you <emphasis>must</emphasis> surround
|
|
|
|
timeouts and idle functions in this matter.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
As always, you must also surround any calls to GTK+ not made within
|
|
|
|
a signal handler with a gdk_threads_enter()/gdk_threads_leave() pair.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### SECTION See_Also ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO GDK_THREADS_ENTER ##### -->
|
|
|
|
<para>
|
2001-10-17 21:41:47 +00:00
|
|
|
This macro marks the begin of a critical section
|
|
|
|
in which GDK and GTK+ functions can be called.
|
|
|
|
Only one thread at a time can be in such a critial
|
|
|
|
section.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### MACRO GDK_THREADS_LEAVE ##### -->
|
|
|
|
<para>
|
2001-10-17 21:41:47 +00:00
|
|
|
This macro marks the end of a critical section
|
|
|
|
begun with #GDK_THREADS_ENTER.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_threads_enter ##### -->
|
|
|
|
<para>
|
2001-10-17 21:41:47 +00:00
|
|
|
Enters a critical region like #GDK_THREADS_ENTER.
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_threads_leave ##### -->
|
|
|
|
<para>
|
2001-10-17 21:41:47 +00:00
|
|
|
Leaves a critical region begun with gdk_threads_enter().
|
1999-08-16 18:51:52 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-10-29 08:03:34 +00:00
|
|
|
<!-- ##### VARIABLE gdk_threads_mutex ##### -->
|
|
|
|
<para>
|
2001-10-17 21:41:47 +00:00
|
|
|
The #GMutex used to implement the critical region for
|
|
|
|
gdk_threads_enter()/gdk_threads_leave().
|
2000-10-29 08:03:34 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|