aboutsummaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'lstate.c')
-rw-r--r--lstate.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lstate.c b/lstate.c
index c63fe867..1fbefb4b 100644
--- a/lstate.c
+++ b/lstate.c
@@ -284,18 +284,14 @@ static void close_state (lua_State *L) {
284 284
285 285
286LUA_API lua_State *lua_newthread (lua_State *L) { 286LUA_API lua_State *lua_newthread (lua_State *L) {
287 global_State *g; 287 global_State *g = G(L);
288 GCObject *o;
288 lua_State *L1; 289 lua_State *L1;
289 lua_lock(L); 290 lua_lock(L);
290 g = G(L);
291 luaC_checkGC(L); 291 luaC_checkGC(L);
292 /* create new thread */ 292 /* create new thread */
293 L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l; 293 o = luaC_newobjdt(L, LUA_TTHREAD, sizeof(LX), offsetof(LX, l));
294 L1->marked = luaC_white(g); 294 L1 = gco2th(o);
295 L1->tt = LUA_VTHREAD;
296 /* link it on list 'allgc' */
297 L1->next = g->allgc;
298 g->allgc = obj2gco(L1);
299 /* anchor it on L stack */ 295 /* anchor it on L stack */
300 setthvalue2s(L, L->top.p, L1); 296 setthvalue2s(L, L->top.p, L1);
301 api_incr_top(L); 297 api_incr_top(L);