}
else {
/* We cannot resume the thread as the associated task has gone */
- lua_thread_pool_terminate_entry (ud->cfg->lua_thread_pool,
- ctx->thread);
+ lua_thread_pool_terminate_entry_full (ud->cfg->lua_thread_pool,
+ ctx->thread, G_STRLOC, true);
ctx->thread = NULL;
}
}
void
lua_thread_pool_terminate_entry_full (struct lua_thread_pool *pool,
- struct thread_entry *thread_entry, const gchar *loc)
+ struct thread_entry *thread_entry, const gchar *loc,
+ bool enforce)
{
struct thread_entry *ent = NULL;
- /* we should only terminate failed threads */
- g_assert (lua_status (thread_entry->lua_state) != 0 && lua_status (thread_entry->lua_state) != LUA_YIELD);
+
+ if (!enforce) {
+ /* we should only terminate failed threads */
+ g_assert (lua_status(thread_entry->lua_state) != 0 &&
+ lua_status(thread_entry->lua_state) != LUA_YIELD);
+ }
if (pool->running_entry == thread_entry) {
pool->running_entry = NULL;
* Maybe there is a way to recover here.
* For now, just remove faulty thread
*/
- lua_thread_pool_terminate_entry_full (pool, thread_entry, loc);
+ lua_thread_pool_terminate_entry_full (pool, thread_entry, loc, false);
}
}
}
void
lua_thread_pool_terminate_entry_full (struct lua_thread_pool *pool,
struct thread_entry *thread_entry,
- const gchar *loc);
+ const gchar *loc, bool enforce);
#define lua_thread_pool_terminate_entry(pool, thread_entry) \
- lua_thread_pool_terminate_entry_full (pool, thread_entry, G_STRLOC)
+ lua_thread_pool_terminate_entry_full (pool, thread_entry, G_STRLOC, false)
#ifdef __cplusplus
}