aboutsummaryrefslogtreecommitdiffstats
path: root/src/events.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2012-01-31 21:24:32 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2012-01-31 21:24:32 +0400
commit2d708971163dc99f9c29cc47e7d4f56a3af882c5 (patch)
tree91d29c6ac7727405e01f065eabe062431302483c /src/events.h
parent3958296431df16a30550047103008c1324fa331a (diff)
downloadrspamd-2d708971163dc99f9c29cc47e7d4f56a3af882c5.tar.gz
rspamd-2d708971163dc99f9c29cc47e7d4f56a3af882c5.zip
Rework events library slightly:
- forced events are no longer checked or created - add async threads to prevent session to be destroyed till all threads are finished
Diffstat (limited to 'src/events.h')
-rw-r--r--src/events.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/events.h b/src/events.h
index 2aba3eb2e..138920060 100644
--- a/src/events.h
+++ b/src/events.h
@@ -10,7 +10,6 @@ typedef void (*event_finalizer_t)(void *user_data);
struct rspamd_async_event {
event_finalizer_t fin;
void *user_data;
- gboolean forced;
guint ref;
};
@@ -19,10 +18,10 @@ struct rspamd_async_session {
event_finalizer_t restore;
event_finalizer_t cleanup;
GHashTable *events;
- GQueue *forced_events;
void *user_data;
memory_pool_t *pool;
gboolean wanna_die;
+ guint threads;
};
/**
@@ -43,19 +42,11 @@ struct rspamd_async_session *new_async_session (memory_pool_t *pool,
* @param session session object
* @param fin finalizer callback
* @param user_data abstract user_data
- * @param forced session cannot be destroyed until forced event are still in it
+ * @param forced unused
*/
void register_async_event (struct rspamd_async_session *session,
event_finalizer_t fin, void *user_data, gboolean forced);
-
-/**
- * Remove forced event
- * @param session session object
- * @param fin destructor function
- */
-void remove_forced_event (struct rspamd_async_session *session, event_finalizer_t fin);
-
/**
* Remove normal event
* @param session session object
@@ -77,4 +68,16 @@ gboolean destroy_session (struct rspamd_async_session *session);
*/
gboolean check_session_pending (struct rspamd_async_session *session);
+/**
+ * Add new async thread to session
+ * @param session session object
+ */
+void register_async_thread (struct rspamd_async_session *session);
+
+/**
+ * Remove async thread from session and check whether session can be terminated
+ * @param session session object
+ */
+void remove_async_thread (struct rspamd_async_session *session);
+
#endif /* RSPAMD_EVENTS_H */