diff options
Diffstat (limited to 'src/LuaSL/LuaSL_threads.c')
-rw-r--r-- | src/LuaSL/LuaSL_threads.c | 10 |
1 files changed, 7 insertions, 3 deletions
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) | |||
298 | recycled *trash; | 298 | recycled *trash; |
299 | 299 | ||
300 | // Try to recycle a Lua state, otherwise create one from scratch. | 300 | // Try to recycle a Lua state, otherwise create one from scratch. |
301 | #if 0 // TODO - something about this causes a crash. | ||
301 | pthread_mutex_lock(&mutex_recycle_list); | 302 | pthread_mutex_lock(&mutex_recycle_list); |
302 | /* pop list head */ | 303 | /* pop list head */ |
303 | if ((trash = (recycled *) eina_clist_head(&recyclelp))) | 304 | if ((trash = (recycled *) eina_clist_head(&recyclelp))) |
304 | { | 305 | { |
306 | printf(" Reusing Lua trash.\n"); | ||
305 | eina_clist_remove(&(trash->node)); | 307 | eina_clist_remove(&(trash->node)); |
306 | lp->L = trash->L; | 308 | lp->L = trash->L; |
307 | free(trash); | 309 | free(trash); |
308 | } | 310 | } |
309 | pthread_mutex_unlock(&mutex_recycle_list); | 311 | pthread_mutex_unlock(&mutex_recycle_list); |
312 | #endif | ||
310 | 313 | ||
311 | if (NULL == lp->L) | 314 | if (NULL == lp->L) |
312 | { | 315 | { |
313 | lp->L = luaL_newstate(); | 316 | lp->L = luaL_newstate(); |
314 | 317 | ||
315 | /* store the script struct in its own Lua state */ | ||
316 | lua_pushlightuserdata(lp->L, lp); | ||
317 | lua_setfield(lp->L, LUA_REGISTRYINDEX, "_SELF"); | ||
318 | luaL_openlibs(lp->L); | 318 | luaL_openlibs(lp->L); |
319 | luaL_register(lp->L, "luaproc", luaproc_funcs_child); | 319 | luaL_register(lp->L, "luaproc", luaproc_funcs_child); |
320 | } | 320 | } |
321 | 321 | ||
322 | /* store the script struct in its own Lua state */ | ||
323 | lua_pushlightuserdata(lp->L, lp); | ||
324 | lua_setfield(lp->L, LUA_REGISTRYINDEX, "_SELF"); | ||
325 | |||
322 | lp->status = LUAPROC_STAT_IDLE; | 326 | lp->status = LUAPROC_STAT_IDLE; |
323 | lp->args = 0; | 327 | lp->args = 0; |
324 | eina_clist_element_init(&(lp->node)); | 328 | eina_clist_element_init(&(lp->node)); |