diff options
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -318,9 +318,10 @@ static void close_state (lua_State *L) { | |||
318 | 318 | ||
319 | 319 | ||
320 | LUA_API lua_State *lua_newthread (lua_State *L) { | 320 | LUA_API lua_State *lua_newthread (lua_State *L) { |
321 | global_State *g = G(L); | 321 | global_State *g; |
322 | lua_State *L1; | 322 | lua_State *L1; |
323 | lua_lock(L); | 323 | lua_lock(L); |
324 | g = G(L); | ||
324 | luaC_checkGC(L); | 325 | luaC_checkGC(L); |
325 | /* create new thread */ | 326 | /* create new thread */ |
326 | L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l; | 327 | L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l; |
@@ -437,8 +438,8 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
437 | 438 | ||
438 | 439 | ||
439 | LUA_API void lua_close (lua_State *L) { | 440 | LUA_API void lua_close (lua_State *L) { |
440 | L = G(L)->mainthread; /* only the main thread can be closed */ | ||
441 | lua_lock(L); | 441 | lua_lock(L); |
442 | L = G(L)->mainthread; /* only the main thread can be closed */ | ||
442 | close_state(L); | 443 | close_state(L); |
443 | } | 444 | } |
444 | 445 | ||