From: Vsevolod Stakhov Date: Tue, 21 Feb 2012 11:01:41 +0000 (+0400) Subject: Another workaround for old glib. X-Git-Tag: 0.5.0~67 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=13d35d6e24df40bd6764b0bb9a9bc1f554508fab;p=rspamd.git Another workaround for old glib. --- diff --git a/src/main.c b/src/main.c index b55186ce3..caced2b17 100644 --- a/src/main.c +++ b/src/main.c @@ -386,7 +386,10 @@ fork_worker (struct rspamd_main *rspamd, struct worker_conf *cf) close_log (rspamd->logger); open_log (rspamd->logger); #if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION <= 30)) - g_thread_init (NULL); + /* Ugly hack for old glib */ + if (!g_thread_get_initialized ()) { + g_thread_init (NULL); + } #endif msg_info ("starting %s process %P", cf->worker->name, getpid ()); cf->worker->worker_start_func (cur); diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c index 5112678bc..35be00bd7 100644 --- a/src/plugins/regexp.c +++ b/src/plugins/regexp.c @@ -1287,7 +1287,9 @@ process_regexp_item (struct worker_task *task, void *user_data) if (!item->lua_function && regexp_module_ctx->max_threads > 1) { if (regexp_module_ctx->workers == NULL) { #if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION <= 30)) - g_thread_init (NULL); + if (! g_thread_get_initialized ()) { + g_thread_init (NULL); + } workers_mtx = g_mutex_new (); #else workers_mtx = memory_pool_alloc (regexp_module_ctx->regexp_pool, sizeof (GMutex));