MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / finishCcall

Function finishCcall

lib/lua/src/ldo.c:708–728  ·  view source on GitHub ↗

** Completes the execution of a C function interrupted by an yield. ** The interruption must have happened while the function was either ** closing its tbc variables in 'moveresults' or executing ** 'lua_callk'/'lua_pcallk'. In the first case, it just redoes ** 'luaD_poscall'. In the second case, the call to 'finishpcallk' ** finishes the interrupted execution of 'lua_pcallk'. After that, it ** c

Source from the content-addressed store, hash-verified

706** conservative and use LUA_MULTRET (always adjust).
707*/
708static void finishCcall (lua_State *L, CallInfo *ci) {
709 int n; /* actual number of results from C function */
710 if (ci->callstatus & CIST_CLSRET) { /* was returning? */
711 lua_assert(hastocloseCfunc(ci->nresults));
712 n = ci->u2.nres; /* just redo 'luaD_poscall' */
713 /* don't need to reset CIST_CLSRET, as it will be set again anyway */
714 }
715 else {
716 int status = LUA_YIELD; /* default if there were no errors */
717 /* must have a continuation and must be able to call it */
718 lua_assert(ci->u.c.k != NULL && yieldable(L));
719 if (ci->callstatus & CIST_YPCALL) /* was inside a 'lua_pcallk'? */
720 status = finishpcallk(L, ci); /* finish it */
721 adjustresults(L, LUA_MULTRET); /* finish 'lua_callk' */
722 lua_unlock(L);
723 n = (*ci->u.c.k)(L, status, ci->u.c.ctx); /* call continuation */
724 lua_lock(L);
725 api_checknelems(L, n);
726 }
727 luaD_poscall(L, ci, n); /* finish 'luaD_call' */
728}
729
730
731/*

Callers 1

unrollFunction · 0.85

Calls 2

finishpcallkFunction · 0.85
luaD_poscallFunction · 0.85

Tested by

no test coverage detected