Re: GIO will link with -pthread soon
- From: Tristan Van Berkom <tvb gnome org>
- To: Tor Lillqvist <tml iki fi>
- Cc: gtk-devel-list <gtk-devel-list gnome org>
- Subject: Re: GIO will link with -pthread soon
- Date: Fri, 20 Nov 2009 12:25:26 -0200
On Fri, Nov 20, 2009 at 11:27 AM, Tor Lillqvist <tml iki fi> wrote:
>> We really need to get our story together here. Either we do our very
>> best to handle late g_thread_init(), or we should fail spectactularly.
>
> Agree 100%.
>
> My own humble opinion is that even GLib (not just GIO) should link to
> -lpthread and work as if g_thread_init(NULL) would have been
> implicitly called before any other GLib calls.
> g_threads_got_initialized would be TRUE always. But I certainly admit
> I don't understand all the implications of this, and implementation
> details it would require, especially on Linux. (On Windows, ~all code
> compiled by modern C compilers, certainly including the GTK+ stack,
> use a multi-thread-aware C library always anyway, which corresponds
> more or less to linking with -lpthread on Linux, I think.)
>
>> I guess orbit needing this is the main reason why we can't just make it fail?
>
> I attempted last year to make ORBit2 *not* call g_thread_init()
> itself, "as it is usually too late", but had to revert it. See bug
> #547885 .
>
Personally I strongly feel that we should make g_thread_init() fail when
called late at the risk of crashing/locking another initialized thread
aware library.
While its possible to teach these libraries to do some really complex stuff,
I think fixing the thread aware libraries up to support late thread
initialization
misses the mark in as much as it sends a message to software developers
that they should support late thread initialization when writing a library.
I'm quite convinced this is only a situation we've put ourselves in by writing
modules that initialized threads late in the game (sure we were young and
didnt know anything about threads ;-D), I'm a little scared that the complex
fix for this internally - will inevitably become the standard implementation
externally, which IMO is more scary than the bug itself; we should encourage
people to get it right the first time instead.
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]