From d06706b346854cd73631aeb6297418ff82cabdf9 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Wed, 14 May 2014 14:33:50 +1000 Subject: Actually implement LSL script resetting, and some associated fixes. --- src/LuaSL/LuaSL_threads.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/LuaSL/LuaSL_threads.c') diff --git a/src/LuaSL/LuaSL_threads.c b/src/LuaSL/LuaSL_threads.c index 234a7c5..e326e14 100644 --- a/src/LuaSL/LuaSL_threads.c +++ b/src/LuaSL/LuaSL_threads.c @@ -298,27 +298,31 @@ void newProc(const char *code, int file, script *lp) recycled *trash; // Try to recycle a Lua state, otherwise create one from scratch. +#if 0 // TODO - something about this causes a crash. pthread_mutex_lock(&mutex_recycle_list); /* pop list head */ if ((trash = (recycled *) eina_clist_head(&recyclelp))) { + printf(" Reusing Lua trash.\n"); eina_clist_remove(&(trash->node)); lp->L = trash->L; free(trash); } pthread_mutex_unlock(&mutex_recycle_list); +#endif if (NULL == lp->L) { lp->L = luaL_newstate(); - /* store the script struct in its own Lua state */ - lua_pushlightuserdata(lp->L, lp); - lua_setfield(lp->L, LUA_REGISTRYINDEX, "_SELF"); luaL_openlibs(lp->L); luaL_register(lp->L, "luaproc", luaproc_funcs_child); } + /* store the script struct in its own Lua state */ + lua_pushlightuserdata(lp->L, lp); + lua_setfield(lp->L, LUA_REGISTRYINDEX, "_SELF"); + lp->status = LUAPROC_STAT_IDLE; lp->args = 0; eina_clist_element_init(&(lp->node)); -- cgit v1.1