After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 532778 - Allow use without g_thread_init()
Allow use without g_thread_init()
Status: RESOLVED OBSOLETE
Product: libsoup
Classification: Core
Component: Misc
unspecified
Other Linux
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
Depends on: 548287
Blocks:
 
 
Reported: 2008-05-12 14:52 UTC by Dan Winship
Modified: 2010-08-16 02:20 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Dan Winship 2008-05-12 14:52:08 UTC
Currently libsoup requires apps to call g_thread_init() even if they aren't planning to use libsoup multithreadedly, because libsoup uses threads internally to do asynchronous DNS (and cancellable synchronous DNS).

Some people don't want to initialize glib-level threads. There are various ways we could fix this:

    1. Go back to the old soup 0.x style of using fork() rather than threads.
       This sucks because it's much more heavyweight.

    2. Use getaddrinfo_a(). This sucks because that function only exists in
       glibc, so we'd get a situation where you wouldn't need to call
       g_thread_init() on Linux, but you *would* need to on all other OSes.

    3. Use an external async-resolver library like c-ares. But given the
       number of different ways glibc's resolver behavior can be configured
       (nsswitch, nscache, gai.conf, etc), this is likely to give
       "incorrect" answers in some situations.

    4. Use pthreads (/ Windows threads) directly and just avoid using any
       glib methods in the DNS thread. (Signal the main thread when results
       are ready by writing to a pipe.)

I think 4 is the best solution
Comment 1 Dan Winship 2008-05-12 14:53:12 UTC
Oh, in addition to the soup-dns changes, the fix will need to conditionalize the use of mutexes elsewhere in libsoup (eg, SoupMessageQueue).
Comment 2 Dan Winship 2008-09-30 18:34:54 UTC
The dns bits are now bug 548287; leaving this bug around to remind me to do the non-dns-related thread bits mentioned in comment #1
Comment 3 Dan Winship 2010-08-16 02:20:43 UTC
gobject now always calls g_thread_init, so this bug is now irrelevant/unfixable