mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 11:08:25 +00:00
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
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user