MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / lua_newthread

Function lua_newthread

src/Chain/libraries/glua/lstate.cpp:259–286  ·  view source on GitHub ↗

TODO: lua_State�е����ֶ�û�����ã�������ʱû�õ�Э��

Source from the content-addressed store, hash-verified

257
258// TODO: lua_State�е����ֶ�û�����ã�������ʱû�õ�Э��
259LUA_API lua_State *lua_newthread(lua_State *L) {
260 global_State *g = G(L);
261 lua_State *L1;
262 lua_lock(L);
263 luaC_checkGC(L);
264 /* create new thread */
265 L1 = &lua_cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l;
266 L1->marked = luaC_white(g);
267 L1->tt = LUA_TTHREAD;
268 /* link it on list 'allgc' */
269 L1->next = g->allgc;
270 g->allgc = obj2gco(L1);
271 /* anchor it on L stack */
272 setthvalue(L, L->top, L1);
273 api_incr_top(L);
274 preinit_thread(L1, g);
275 L1->hookmask = L->hookmask;
276 L1->basehookcount = L->basehookcount;
277 L1->hook = L->hook;
278 resethookcount(L1);
279 /* initialize L1 extra space */
280 memcpy(lua_getextraspace(L1), lua_getextraspace(g->mainthread),
281 LUA_EXTRASPACE);
282 luai_userstatethread(L, L1);
283 stack_init(L1, L); /* init stack */
284 lua_unlock(L);
285 return L1;
286}
287
288
289void luaE_freethread(lua_State *L, lua_State *L1) {

Callers 1

luaB_cocreateFunction · 0.85

Calls 2

preinit_threadFunction · 0.85
stack_initFunction · 0.85

Tested by

no test coverage detected