GNOME Bugzilla – Bug 532778
Allow use without g_thread_init()
Last modified: 2010-08-16 02:20:43 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
Oh, in addition to the soup-dns changes, the fix will need to conditionalize the use of mutexes elsewhere in libsoup (eg, SoupMessageQueue).
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
gobject now always calls g_thread_init, so this bug is now irrelevant/unfixable