diff options
Diffstat (limited to 'src/lua/lua_thread_pool.h')
-rw-r--r-- | src/lua/lua_thread_pool.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/lua/lua_thread_pool.h b/src/lua/lua_thread_pool.h index b72b72e8d..e5b2f2873 100644 --- a/src/lua/lua_thread_pool.h +++ b/src/lua/lua_thread_pool.h @@ -3,13 +3,25 @@ #include <lua.h> +struct thread_entry; +struct lua_thread_pool; + +typedef void (*lua_thread_finish_t) (struct thread_entry *thread, int ret); +typedef void (*lua_thread_error_t) (struct thread_entry *thread, int ret, const char *msg); + struct thread_entry { lua_State *lua_state; gint thread_index; gpointer cd; -}; -struct thread_pool; + /* function to handle result of called method, can be NULL */ + lua_thread_finish_t finish_callback; + + /* function to log result, i.e. if you want to modify error logging message or somehow process this state, can be NUL */ + lua_thread_error_t error_callback; + struct rspamd_task *task; + struct rspamd_config *cfg; +}; struct lua_callback_state { lua_State *L; @@ -102,5 +114,9 @@ lua_thread_pool_prepare_callback (struct lua_thread_pool *pool, struct lua_callb void lua_thread_pool_restore_callback (struct lua_callback_state *cbs); + +void +lua_thread_call (struct lua_thread_pool *pool, struct thread_entry *thread_entry, int narg); + #endif /* LUA_THREAD_POOL_H_ */ |