Re: When to call g_thread_init(), again...



On Fri, 2008-08-15 at 16:05 +0300, Tor Lillqvist wrote:
> > "If your program uses threads (or other libraries that use threads),
> > then you must call g_thread_init() before calling any other GLib
> > function"
> 
> It's not using threads that is the key point here. Calling
> g_thread_init() is. That already changes some GLib functions to work
> in different ways, incompatible with how they work before
> g_thread_init() is called. Whether any threads then are created or not
> is not relevant, not for this discussion at least;)

"If your code calls g_thread_init(), it must ensure that g_thread_init()
is called before any other GLib function. This includes other calls
to g_thread_init() made by libraries that your code is linked to."

of course, given init/fini/constructor/destructor semantics in
libraries, there actually is no way to ensure that this happens, but the
programmer can at least do the best they can.




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