multithreading - Lua 5.2.2 Broken Threading System -
ey, i'm making threading system in lua , have crash when resume lot threads... i'm noob in c lua , don't know or bad i'm doing in next codes... i flagged crash places "//maybe here" #include<cstdio> #include<ala_lua.h> extern"c"{ void __stdcall sleep(unsigned long); }; int main(){ lua_state*l=lual_newstate(); lual_openlibs(l); luaa_libs(l); lua_state*t=lua_newthread(l); lual_loadfile(t,"c:/clua.lua"); co_resume(t); do{ sleep(1); }while(co_update()); lua_close(l); gets(new char[1]); return 0; }; #ifndef ala_lua_h #define ala_lua_h #include<ala_lua_co.h> void luaa_libs(lua_state*); static int luaa_sleep(lua_state*handle){ co_sleep(handle,lua_tointeger(handle,1)); return 0; }; static int luaa_rthread(lua_state*handle){ if(lua_isthread(handle,1)){ co_resume(lua_tothread(handle,1)); }; return 0; }; static int luaa_mthr...