summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/lstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/lstate.c')
-rw-r--r--apps/plugins/lua/lstate.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/plugins/lua/lstate.c b/apps/plugins/lua/lstate.c
index 4313b83a0c..67921d84a1 100644
--- a/apps/plugins/lua/lstate.c
+++ b/apps/plugins/lua/lstate.c
@@ -119,6 +119,8 @@ static void close_state (lua_State *L) {
119lua_State *luaE_newthread (lua_State *L) { 119lua_State *luaE_newthread (lua_State *L) {
120 lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State))); 120 lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State)));
121 luaC_link(L, obj2gco(L1), LUA_TTHREAD); 121 luaC_link(L, obj2gco(L1), LUA_TTHREAD);
122 setthvalue(L, L->top, L1); /* put thread on stack */
123 incr_top(L);
122 preinit_state(L1, G(L)); 124 preinit_state(L1, G(L));
123 stack_init(L1, L); /* init stack */ 125 stack_init(L1, L); /* init stack */
124 setobj2n(L, gt(L1), gt(L)); /* share table of globals */ 126 setobj2n(L, gt(L1), gt(L)); /* share table of globals */
@@ -126,7 +128,8 @@ lua_State *luaE_newthread (lua_State *L) {
126 L1->basehookcount = L->basehookcount; 128 L1->basehookcount = L->basehookcount;
127 L1->hook = L->hook; 129 L1->hook = L->hook;
128 resethookcount(L1); 130 resethookcount(L1);
129 lua_assert(iswhite(obj2gco(L1))); 131 lua_assert(!isdead(G(L), obj2gco(L1)));
132 L->top--; /* remove thread from stack */
130 return L1; 133 return L1;
131} 134}
132 135
@@ -160,6 +163,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
160 g->uvhead.u.l.prev = &g->uvhead; 163 g->uvhead.u.l.prev = &g->uvhead;
161 g->uvhead.u.l.next = &g->uvhead; 164 g->uvhead.u.l.next = &g->uvhead;
162 g->GCthreshold = 0; /* mark it as unfinished state */ 165 g->GCthreshold = 0; /* mark it as unfinished state */
166 g->estimate = 0;
163 g->strt.size = 0; 167 g->strt.size = 0;
164 g->strt.nuse = 0; 168 g->strt.nuse = 0;
165 g->strt.hash = NULL; 169 g->strt.hash = NULL;
@@ -167,6 +171,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
167 luaZ_initbuffer(L, &g->buff); 171 luaZ_initbuffer(L, &g->buff);
168 g->panic = NULL; 172 g->panic = NULL;
169 g->gcstate = GCSpause; 173 g->gcstate = GCSpause;
174 g->gcflags = GCFlagsNone;
170 g->rootgc = obj2gco(L); 175 g->rootgc = obj2gco(L);
171 g->sweepstrgc = 0; 176 g->sweepstrgc = 0;
172 g->sweepgc = &g->rootgc; 177 g->sweepgc = &g->rootgc;