aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coroutine-gthread.c5
-rw-r--r--trace/simple.c5
-rw-r--r--vl.c5
3 files changed, 15 insertions, 0 deletions
diff --git a/coroutine-gthread.c b/coroutine-gthread.c
index fdea27a106..662801b2fa 100644
--- a/coroutine-gthread.c
+++ b/coroutine-gthread.c
@@ -36,7 +36,12 @@ static GStaticPrivate coroutine_key = G_STATIC_PRIVATE_INIT;
static void __attribute__((constructor)) coroutine_init(void)
{
if (!g_thread_supported()) {
+#if !GLIB_CHECK_VERSION(2, 31, 0)
g_thread_init(NULL);
+#else
+ fprintf(stderr, "glib threading failed to initialize.\n");
+ exit(1);
+#endif
}
coroutine_cond = g_cond_new();
diff --git a/trace/simple.c b/trace/simple.c
index 6339152d27..bbc99302b9 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -376,7 +376,12 @@ bool trace_backend_init(const char *events, const char *file)
GThread *thread;
if (!g_thread_supported()) {
+#if !GLIB_CHECK_VERSION(2, 31, 0)
g_thread_init(NULL);
+#else
+ fprintf(stderr, "glib threading failed to initialize.\n");
+ exit(1);
+#endif
}
trace_available_cond = g_cond_new();
diff --git a/vl.c b/vl.c
index 78b790c919..c03abb66ad 100644
--- a/vl.c
+++ b/vl.c
@@ -2176,7 +2176,12 @@ int main(int argc, char **argv, char **envp)
g_mem_set_vtable(&mem_trace);
if (!g_thread_supported()) {
+#if !GLIB_CHECK_VERSION(2, 31, 0)
g_thread_init(NULL);
+#else
+ fprintf(stderr, "glib threading failed to initialize.\n");
+ exit(1);
+#endif
}
runstate_init();