If you use GLib from more than one thread, you must initialize the
thread system by calling g_thread_init(). Most of the time you will
only have to call g_thread_init (NULL).
Note
Do not call g_thread_init() with a non-NULL parameter unless
you really know what you are doing.
Note
g_thread_init() must not be called directly or indirectly as a
callback from GLib. Also no mutexes may be currently locked while
calling g_thread_init().
Note
g_thread_init() changes the way in which GTimer measures
elapsed time. As a consequence, timers that are running while
g_thread_init() is called may report unreliable times.
Calling g_thread_init() multiple times is allowed (since version
2.24), but nothing happens except for the first call. If the
argument is non-NULL on such a call a warning will be printed, but
otherwise the argument is ignored.
If no thread system is available and vtable is NULL or if not all
elements of vtable are non-NULL, then g_thread_init() will abort.
Note
To use g_thread_init() in your program, you have to link with
the libraries that the command pkg-config --libs
gthread-2.0 outputs. This is not the case for all the
other thread related functions of GLib. Those can be used without
having to link with the thread libraries.
If you use GLib from more than one thread, you must initialize the thread system by calling g_thread_init(). Most of the time you will only have to call g_thread_init (NULL). Note Do not call g_thread_init() with a non-NULL parameter unless you really know what you are doing. Note g_thread_init() must not be called directly or indirectly as a callback from GLib. Also no mutexes may be currently locked while calling g_thread_init(). Note g_thread_init() changes the way in which GTimer measures elapsed time. As a consequence, timers that are running while g_thread_init() is called may report unreliable times. Calling g_thread_init() multiple times is allowed (since version 2.24), but nothing happens except for the first call. If the argument is non-NULL on such a call a warning will be printed, but otherwise the argument is ignored. If no thread system is available and vtable is NULL or if not all elements of vtable are non-NULL, then g_thread_init() will abort. Note To use g_thread_init() in your program, you have to link with the libraries that the command pkg-config --libs gthread-2.0 outputs. This is not the case for all the other thread related functions of GLib. Those can be used without having to link with the thread libraries.