tests/test-qmp-event: fix for GLib < 2.31
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 30 Jun 2014 13:05:49 +0000 (15:05 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 30 Jun 2014 13:06:11 +0000 (15:06 +0200)
On old GLib, the test needs a g_thread_init call.

Reported-by: Wenchao Xia <wenchaoqemu@gmail.com>
Tested-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tests/test-qmp-event.c

index cb1e4418ec167c8a804e6ab39b53d4cfe35b7142..cb354e6e81944c4b52320408d67d5b6ef786a06e 100644 (file)
@@ -251,6 +251,12 @@ static void test_event_d(TestEventData *data,
 
 int main(int argc, char **argv)
 {
+#if !GLIB_CHECK_VERSION(2, 31, 0)
+    if (!g_thread_supported()) {
+       g_thread_init(NULL);
+    }
+#endif
+
     qmp_event_set_func_emit(event_test_emit);
 
     g_test_init(&argc, &argv, NULL);