MCPcopy Create free account
hub / github.com/F-Stack/f-stack / lua_resume

Function lua_resume

freebsd/contrib/openzfs/module/lua/ldo.c:610–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

608
609
610LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) {
611 int status;
612 int oldnny = L->nny; /* save 'nny' */
613 lua_lock(L);
614 luai_userstateresume(L, nargs);
615 L->nCcalls = (from) ? from->nCcalls + 1 : 1;
616 L->nny = 0; /* allow yields */
617 api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs);
618 status = luaD_rawrunprotected(L, resume_cb, L->top - nargs);
619 if (status == -1) /* error calling 'lua_resume'? */
620 status = LUA_ERRRUN;
621 else { /* yield or regular error */
622 while (status != LUA_OK && status != LUA_YIELD) { /* error? */
623 if (recover(L, status)) /* recover point? */
624 status = luaD_rawrunprotected(L, unroll, NULL); /* run continuation */
625 else { /* unrecoverable error */
626 L->status = cast_byte(status); /* mark thread as `dead' */
627 seterrorobj(L, status, L->top);
628 L->ci->top = L->top;
629 break;
630 }
631 }
632 lua_assert(status == L->status);
633 }
634 L->nny = oldnny; /* restore 'nny' */
635 L->nCcalls--;
636 lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0));
637 lua_unlock(L);
638 return status;
639}
640
641
642LUA_API int lua_yieldk (lua_State *L, int nresults, int ctx, lua_CFunction k) {

Callers 1

auxresumeFunction · 0.70

Calls 3

recoverFunction · 0.85
seterrorobjFunction · 0.85
luaD_rawrunprotectedFunction · 0.70

Tested by

no test coverage detected