MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / costatus

Function costatus

deps/lua/src/lbaselib.c:490–507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488 {"running", "suspended", "normal", "dead"};
489
490static int costatus (lua_State *L, lua_State *co) {
491 if (L == co) return CO_RUN;
492 switch (lua_status(co)) {
493 case LUA_YIELD:
494 return CO_SUS;
495 case 0: {
496 lua_Debug ar;
497 if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */
498 return CO_NOR; /* it is running */
499 else if (lua_gettop(co) == 0)
500 return CO_DEAD;
501 else
502 return CO_SUS; /* initial state */
503 }
504 default: /* some error occured */
505 return CO_DEAD;
506 }
507}
508
509
510static int luaB_costatus (lua_State *L) {

Callers 2

luaB_costatusFunction · 0.85
auxresumeFunction · 0.85

Calls 3

lua_statusFunction · 0.85
lua_getstackFunction · 0.85
lua_gettopFunction · 0.85

Tested by

no test coverage detected