MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / costatus

Function costatus

lua/lbaselib.c:498–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496 {"running", "suspended", "normal", "dead"};
497
498static int costatus (lua_State *L, lua_State *co) {
499 if (L == co) return CO_RUN;
500 switch (lua_status(co)) {
501 case LUA_YIELD:
502 return CO_SUS;
503 case 0: {
504 lua_Debug ar;
505 if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */
506 return CO_NOR; /* it is running */
507 else if (lua_gettop(co) == 0)
508 return CO_DEAD;
509 else
510 return CO_SUS; /* initial state */
511 }
512 default: /* some error occured */
513 return CO_DEAD;
514 }
515}
516
517
518static 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