Clarification on Glib Thread-Safe Operation
- From: David Judkovics <djudkovi us ibm com>
- To: gtk-list gnome org
- Subject: Clarification on Glib Thread-Safe Operation
- Date: Thu, 02 Oct 2003 10:43:01 -0400
My project makes extensive use of what I believe are glibs non thread related
functions and types. The wording of the documentation concerning glib thread
safe operation has left me confused.
The documentation states glib must be compiled with the macro 'G_THREADS_ENABLED'
defined for thread safe operation.
..."This macro is defined, if GLib was compiled with thread support. This
does not necessarily mean, that there is a thread implementation available,
but the infrastructure is in place and once you provide a thread implementation
to
g_thread_init(),
GLib will be multi-thread safe. It isn't and cannot be, if
G_THREADS_ENABLED is not
defined."...
Later on the documentation for 'g_thread_init()' states,
..."Before you use a thread related function in GLib, you should initialize
the thread system. This is done by calling
g_thread_init(). Most
of the time you will only have to call
g_thread_init(NULL)."...
To me thread safe operation and the use of glib thread related functions
are two distinct configuration issues. The documentation seems to mix them.
This is my confusion.
My project is a library that uses the 'g_slist_' calls extensively, calls
I believe that are not thread related. My project library must be thread
safe. The version of glib we are using does not have 'G_THREADS_ENABLED'
defined. Is my project library thread safe within the context of its use
of glib's 'g_slist_' calls?
Put another way, is glibs 'g_slist_' calls thread safe without 'G_THREADS_ENABLED'
defined?
Cheers
David Judkovics
dmjudkov us ibm com
Adv. Software Engineer
LTC xSeries Linux
IBM Server -- Endicott, NY
Tel: 607-429-4745 - Tie 620-4745
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]