From 259c6ed1642cd6cc0e5cb8bfcfdeed93150b2e99 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 5 Nov 2008 18:21:49 +0100 Subject: [PATCH] enable GLib threading Call g_thread_init() from main() to enable the GLib features which make it thread safe. --- configure.ac | 2 +- src/main.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index bc12d0900..8678e6f98 100644 --- a/configure.ac +++ b/configure.ac @@ -274,7 +274,7 @@ AC_CHECK_LIB(nsl,gethostbyname,MPD_LIBS="$MPD_LIBS -lnsl",) AC_CHECK_LIB(m,exp,MPD_LIBS="$MPD_LIBS -lm",) AC_CHECK_FUNCS(setenv) -PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.4],, +PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.4 gthread-2.0],, [AC_MSG_ERROR([glib-2.4 is required])]) dnl doesn't work for systems that don't have CODESET like OpenBSD diff --git a/src/main.c b/src/main.c index 79b17cda5..e1fc96bdc 100644 --- a/src/main.c +++ b/src/main.c @@ -382,6 +382,9 @@ int main(int argc, char *argv[]) Options options; clock_t start; + /* enable GLib's thread safety code */ + g_thread_init(NULL); + initConf(); parseOptions(argc, argv, &options);