diff options
author | Mikhail Galanin <mgalanin@mimecast.com> | 2018-08-14 14:36:05 +0100 |
---|---|---|
committer | Mikhail Galanin <mgalanin@mimecast.com> | 2018-08-14 14:36:05 +0100 |
commit | 9926cc68e2c143be8a05b91e28ba8830abfea04a (patch) | |
tree | ee8997d9488c9dd67a5a77789377cbd517275d56 /src/lua/lua_thread_pool.c | |
parent | f9d4b50321057009489dbc673b108e6433f4ae38 (diff) | |
download | rspamd-9926cc68e2c143be8a05b91e28ba8830abfea04a.tar.gz rspamd-9926cc68e2c143be8a05b91e28ba8830abfea04a.zip |
[Minor] Use coroutine model in dns resolver API
Diffstat (limited to 'src/lua/lua_thread_pool.c')
-rw-r--r-- | src/lua/lua_thread_pool.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lua/lua_thread_pool.c b/src/lua/lua_thread_pool.c index 07364f270..865b41fce 100644 --- a/src/lua/lua_thread_pool.c +++ b/src/lua/lua_thread_pool.c @@ -14,7 +14,7 @@ static struct thread_entry * thread_entry_new (lua_State * L) { struct thread_entry *ent; - ent = g_malloc (sizeof *ent); + ent = g_new0(struct thread_entry, 1); ent->lua_state = lua_newthread (L); ent->thread_index = luaL_ref (L, LUA_REGISTRYINDEX); @@ -75,6 +75,8 @@ lua_thread_pool_get(struct lua_thread_pool *pool) ent = thread_entry_new (pool->L); } + pool->running_entry = ent; + return ent; } @@ -88,6 +90,7 @@ lua_thread_pool_return(struct lua_thread_pool *pool, struct thread_entry *thread } if (g_queue_get_length (pool->available_items) <= pool->max_items) { + thread_entry->cd = NULL; g_queue_push_head (pool->available_items, thread_entry); } else { |