Browse Source

Larger C-stack limits for new threads

New threads were being created with very small C-stack limits.
This is not a problem for coroutines, because 'lua_resume' sets
a new limit, but not all threads are coroutines.
Roberto Ierusalimschy 5 years ago
parent
commit
6e1aec7a67
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lstate.c

+ 1 - 1
lstate.c

@@ -286,7 +286,6 @@ static void preinit_thread (lua_State *L, global_State *g) {
   L->stacksize = 0;
   L->stacksize = 0;
   L->twups = L;  /* thread has no upvalues */
   L->twups = L;  /* thread has no upvalues */
   L->errorJmp = NULL;
   L->errorJmp = NULL;
-  L->nCcalls = CSTACKTHREAD;
   L->hook = NULL;
   L->hook = NULL;
   L->hookmask = 0;
   L->hookmask = 0;
   L->basehookcount = 0;
   L->basehookcount = 0;
@@ -327,6 +326,7 @@ LUA_API lua_State *lua_newthread (lua_State *L) {
   setthvalue2s(L, L->top, L1);
   setthvalue2s(L, L->top, L1);
   api_incr_top(L);
   api_incr_top(L);
   preinit_thread(L1, g);
   preinit_thread(L1, g);
+  L1->nCcalls = getCcalls(L);
   L1->hookmask = L->hookmask;
   L1->hookmask = L->hookmask;
   L1->basehookcount = L->basehookcount;
   L1->basehookcount = L->basehookcount;
   L1->hook = L->hook;
   L1->hook = L->hook;