diff options
author | Mikhail Galanin <mgalanin@mimecast.com> | 2018-08-24 09:13:24 +0100 |
---|---|---|
committer | Mikhail Galanin <mgalanin@mimecast.com> | 2018-08-24 09:13:24 +0100 |
commit | 6d12ba86f224b77a5047643e7c304fef1d763b26 (patch) | |
tree | 2a349f5107a18d2d0f8d8d5a2bfece1c93e6c83a /src/lua/lua_thread_pool.h | |
parent | ed9d4ec8c8b62664f0157ccb6dceaba264e1891b (diff) | |
download | rspamd-6d12ba86f224b77a5047643e7c304fef1d763b26.tar.gz rspamd-6d12ba86f224b77a5047643e7c304fef1d763b26.zip |
[Minor] Split lua_thread_pool_get on lua_thread_pool_get_for_task/lua_thread_pool_get_for_config
Diffstat (limited to 'src/lua/lua_thread_pool.h')
-rw-r--r-- | src/lua/lua_thread_pool.h | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/lua/lua_thread_pool.h b/src/lua/lua_thread_pool.h index c77f77455..bdf5586d6 100644 --- a/src/lua/lua_thread_pool.h +++ b/src/lua/lua_thread_pool.h @@ -55,11 +55,20 @@ lua_thread_pool_free (struct lua_thread_pool *pool); * * If the code performed YIELD, the thread is still running and it's live should be controlled by the callee * - * @param pool + * @param task * @return */ struct thread_entry * -lua_thread_pool_get(struct lua_thread_pool *pool); +lua_thread_pool_get_for_task (struct rspamd_task *task); + +/** + * The same, but used when task is not available + * + * @param cfg + * @return + */ +struct thread_entry * +lua_thread_pool_get_for_config (struct rspamd_config *cfg); /** * Return thread into the list of available ones. It can't be done with yielded or dead threads. @@ -116,5 +125,23 @@ lua_thread_pool_restore_callback (struct lua_callback_state *cbs); void lua_thread_call (struct thread_entry *thread_entry, int narg); +/** + * Yields thread. should be only called in return statement + * @param thread_entry + * @param nresults + * @return + */ +int +lua_thread_yield (struct thread_entry *thread_entry, int nresults); + +/** + * Resumes suspended by lua_yield_thread () thread + * @param task + * @param thread_entry + * @param narg + */ +void +lua_thread_resume (struct thread_entry *thread_entry, int narg); + #endif /* LUA_THREAD_POOL_H_ */ |