Make sure that main thread is non yieldable

Main thread must be non yieldable even at "level 0" (bare API), outside
the 'pcall' from 'lua.c'.
This commit is contained in:
Roberto Ierusalimschy
2020-07-06 13:54:01 -03:00
parent 6298903e35
commit d39ea8b3ce
3 changed files with 18 additions and 4 deletions

View File

@@ -395,6 +395,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
g->allgc = obj2gco(L); /* by now, only object is the main thread */
L->next = NULL;
g->Cstacklimit = L->nCcalls = LUAI_MAXCSTACK + CSTACKERR;
incnny(L); /* main thread is always non yieldable */
g->frealloc = f;
g->ud = ud;
g->warnf = NULL;