summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2012-02-21 15:01:41 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2012-02-21 15:01:41 +0400
commit13d35d6e24df40bd6764b0bb9a9bc1f554508fab (patch)
tree348336de95d1a6cac10f858aaa5efcff419dd62a
parent5218877e6a4daf614fc765927af8b0cda02bc95f (diff)
downloadrspamd-13d35d6e24df40bd6764b0bb9a9bc1f554508fab.tar.gz
rspamd-13d35d6e24df40bd6764b0bb9a9bc1f554508fab.zip
Another workaround for old glib.
-rw-r--r--src/main.c5
-rw-r--r--src/plugins/regexp.c4
2 files changed, 7 insertions, 2 deletions
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));