g_thread_init should be called before any other glib function.