]> source.dussan.org Git - rspamd.git/commitdiff
Another workaround for old glib.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Tue, 21 Feb 2012 11:01:41 +0000 (15:01 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Tue, 21 Feb 2012 11:01:41 +0000 (15:01 +0400)
src/main.c
src/plugins/regexp.c

index b55186ce3e1968c7da75b4a6a1a1fa5c6965ae00..caced2b171d8f93449905418c1008ced2eff4439 100644 (file)
@@ -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);
index 5112678bc053c9fe05b3511c7109e3084e9f6d0b..35be00bd78d05bc36cd11d6125bb0246fc13334d 100644 (file)
@@ -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));