MCPcopy Create free account
hub / github.com/Tencent/sluaunreal / lua_newthread

Function lua_newthread

Plugins/slua_unreal/External/lua/lstate.cpp:257–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

luaB_cocreateFunction · 0.85

Calls 3

GFunction · 0.85
preinit_threadFunction · 0.85
stack_initFunction · 0.85

Tested by

no test coverage detected