lua-users home
lua-l archive

lua thread corruption

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello everyone,
I have issue with lua threads that i can't seem to figure out.
I use lua_newthread for each new lua call, and i have a wait command implemented like this:
int Wait(lua_State* state)
{
 CHECK_ARGUMENT_COUNT(1, "Wait");
 // first param - time to wait
 const int time_to_wait = lua_tointeger(state, 1);
 GX_ASSERT(time_to_wait > 0);
 lua_pushinteger(state, E_WAIT_DELAY);
 lua_pushinteger(state, time_to_wait);
 return lua_yield(state, 2);
}
For some reason, at random times one of my yield-ed threads get garbage collected by lua GC, resulting in a crash when i try to resume that thread. The deleted thread's status is LUA_YIELD, Also, the thread->stack->tt seems to be corrupted (it has a 0xdddddddd value). Do you have any ideea what could generate this type of behavior, lua gc to delete a yield-ed thread?
Thanks,
Cristi.

AltStyle によって変換されたページ (->オリジナル) /