diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-02-13 21:51:10 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-02-13 21:51:10 +0400 |
commit | a5b48a05a94d178c342bbad69a330addb518d148 (patch) | |
tree | ee7ab452cd4a98fdb7503e78cc52a3d4f66dd27e /src/worker.c | |
parent | 0d64c808b7310b6e233ec570649fbb281a3f2b13 (diff) | |
download | rspamd-a5b48a05a94d178c342bbad69a330addb518d148.tar.gz rspamd-a5b48a05a94d178c342bbad69a330addb518d148.zip |
* More things to be thread-safe:
- pool allocator is now thread-safe
- lua subsystem now holds lock to avoid lua stack corruption
- events subsystem now using conditional variables to wait for async_threads
- insert_result is thread-safe now
Diffstat (limited to 'src/worker.c')
-rw-r--r-- | src/worker.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/worker.c b/src/worker.c index f113e04d9..d56c2d924 100644 --- a/src/worker.c +++ b/src/worker.c @@ -613,7 +613,7 @@ err_socket (GError * err, void *arg) /* * Called if all filters are processed */ -static void +static gboolean fin_task (void *arg) { struct worker_task *task = (struct worker_task *) arg; @@ -630,20 +630,25 @@ fin_task (void *arg) /* Just process composites */ make_composites (task); } - /* Call post filters */ - lua_call_post_filters (task); + if (task->cfg->post_filters) { + /* More to process */ + /* Special state */ + task->state = WAIT_POST_FILTER; + return FALSE; + } + } /* Check if we have all events finished */ - if (g_hash_table_size (task->s->events) == 0 && task->s->threads == 0) { - task->state = WRITE_REPLY; - if (task->fin_callback) { - task->fin_callback (task->fin_arg); - } - else { - rspamd_dispatcher_restore (task->dispatcher); - } + task->state = WRITE_REPLY; + if (task->fin_callback) { + task->fin_callback (task->fin_arg); + } + else { + rspamd_dispatcher_restore (task->dispatcher); } + + return TRUE; } /* @@ -654,8 +659,8 @@ restore_task (void *arg) { struct worker_task *task = (struct worker_task *) arg; - /* Special state */ - task->state = WAIT_POST_FILTER; + /* Call post filters */ + lua_call_post_filters (task); task->s->wanna_die = TRUE; } |