summary refs log tree commit diff stats
path: root/coroutine-gthread.c
diff options
context:
space:
mode:
authorMichael Tokarev <mjt@tls.msk.ru>2014-05-02 18:35:55 +0400
committerMichael Tokarev <mjt@tls.msk.ru>2014-05-07 21:00:43 +0400
commitf33cc84dd4af7776309d118412df008ec4108a57 (patch)
tree74e48586df6aa4df8ee651827f30e2ed55d27e02 /coroutine-gthread.c
parent69b15212d761889b2768b654f09a0eac78951674 (diff)
downloadfocaccia-qemu-f33cc84dd4af7776309d118412df008ec4108a57.tar.gz
focaccia-qemu-f33cc84dd4af7776309d118412df008ec4108a57.zip
do not call g_thread_init() for glib >= 2.31
glib >= 2.31 always enables thread support and g_thread_supported()
is #defined to 1, there's no need to call g_thread_init() anymore,
and it definitely does not need to report error which never happens.
Keep code for old < 2.31 glibc anyway for now, just #ifdef it
differently.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-trivial@nongnu.org
Diffstat (limited to 'coroutine-gthread.c')
-rw-r--r--coroutine-gthread.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/coroutine-gthread.c b/coroutine-gthread.c
index d3e5b991f7..a61efe01dc 100644
--- a/coroutine-gthread.c
+++ b/coroutine-gthread.c
@@ -115,14 +115,11 @@ static inline GThread *create_thread(GThreadFunc func, gpointer data)
 
 static void __attribute__((constructor)) coroutine_init(void)
 {
-    if (!g_thread_supported()) {
 #if !GLIB_CHECK_VERSION(2, 31, 0)
+    if (!g_thread_supported()) {
         g_thread_init(NULL);
-#else
-        fprintf(stderr, "glib threading failed to initialize.\n");
-        exit(1);
-#endif
     }
+#endif
 
     init_coroutine_cond();
 }