diff options
author | Mikhail Galanin <mgalanin@mimecast.com> | 2018-08-22 15:58:22 +0100 |
---|---|---|
committer | Mikhail Galanin <mgalanin@mimecast.com> | 2018-08-22 15:58:22 +0100 |
commit | 434446f72add375d0f7a94a94e4797d9bd6d1d6a (patch) | |
tree | 24e55dc6adbda02c7451438211f444ff0ecb7eed /src/lua/lua_thread_pool.h | |
parent | ac38a392e434721bd80360a78385a069e31e5f09 (diff) | |
download | rspamd-434446f72add375d0f7a94a94e4797d9bd6d1d6a.tar.gz rspamd-434446f72add375d0f7a94a94e4797d9bd6d1d6a.zip |
[Minor] Move resume/yield methods into appropriate place
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_ */ |