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



On Fri, 2008-08-15 at 19:09 +0200, Milosz Derezynski wrote:
> Also, is there any specific reason *not* to call g_thread_init() in
> glib's init routine by default anyway? Any penalties?

As was pointed out, there's no GLib init routine, but from the
standpoint of a prominent library that we use a fair bit that does have
an init function - ie, GTK's gtk_init() - the library's internal
behaviour changes significantly if the developer using enables threading
(ie, it starts doing things in multiple threads in certain places it
would have done single threaded with idle callbacks otherwise)

...even if that developer does not subsequently create any threads of
their "own".

Is that a penalty? If you're not writing (don't want) a multiple
threaded program, then you bet it's a penalty. On the other hand, if
you're safely running a multi-threaded application anyway, then "sure,
go for it" and, frankly, it's pretty cool that the library kicks it up a
notch.

But clearly, it's got to be the application developer who makes the
choice to call g_thread_init().

AfC
Sydney




Attachment: signature.asc
Description: This is a digitally signed message part



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