aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_thread_pool.h
diff options
context:
space:
mode:
authorMikhail Galanin <mgalanin@mimecast.com>2018-08-08 09:01:49 +0100
committerMikhail Galanin <mgalanin@mimecast.com>2018-08-08 09:06:27 +0100
commit2c501018c04ca0a972c600b1324be21545e9f133 (patch)
tree7b7b81462669ae5a7c52d1956ba525e1022c5400 /src/lua/lua_thread_pool.h
parent77d8a4588723e97c6f6a3cfef584a6ef5516b951 (diff)
downloadrspamd-2c501018c04ca0a972c600b1324be21545e9f133.tar.gz
rspamd-2c501018c04ca0a972c600b1324be21545e9f133.zip
[Project] coroutine threaded model for API calls: thread pool
Diffstat (limited to 'src/lua/lua_thread_pool.h')
-rw-r--r--src/lua/lua_thread_pool.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/lua/lua_thread_pool.h b/src/lua/lua_thread_pool.h
new file mode 100644
index 000000000..01643df9e
--- /dev/null
+++ b/src/lua/lua_thread_pool.h
@@ -0,0 +1,35 @@
+#ifndef LUA_THREAD_POOL_H_
+#define LUA_THREAD_POOL_H_
+
+#include <lua.h>
+
+struct thread_entry {
+ lua_State *lua_state;
+ gint thread_index;
+};
+
+struct thread_pool;
+
+struct lua_thread_pool *
+lua_thread_pool_new (lua_State * L);
+
+void
+lua_thread_pool_free (struct lua_thread_pool *pool);
+
+struct thread_entry *
+lua_thread_pool_get(struct lua_thread_pool *pool);
+
+void
+lua_thread_pool_return(struct lua_thread_pool *pool, struct thread_entry *thread_entry);
+
+void
+lua_thread_pool_terminate_entry(struct lua_thread_pool *pool, struct thread_entry *thread_entry);
+
+struct thread_entry *
+lua_thread_pool_get_running_entry(struct lua_thread_pool *pool);
+
+void
+lua_thread_pool_set_running_entry(struct lua_thread_pool *pool, struct thread_entry *thread_entry);
+
+#endif /* LUA_THREAD_POOL_H_ */
+