| 235 | |
| 236 | |
| 237 | LUA_API lua_State *lua_newthread (lua_State *L) { |
| 238 | lua_State *L1; |
| 239 | lua_lock(L); |
| 240 | luaC_checkGC(L); |
| 241 | L1 = &luaC_newobj(L, LUA_TTHREAD, sizeof(LX), NULL, offsetof(LX, l))->th; |
| 242 | setthvalue(L, L->top, L1); |
| 243 | api_incr_top(L); |
| 244 | preinit_state(L1, G(L)); |
| 245 | L1->hookmask = L->hookmask; |
| 246 | L1->basehookcount = L->basehookcount; |
| 247 | L1->hook = L->hook; |
| 248 | resethookcount(L1); |
| 249 | luai_userstatethread(L, L1); |
| 250 | stack_init(L1, L); /* init stack */ |
| 251 | lua_unlock(L); |
| 252 | return L1; |
| 253 | } |
| 254 | |
| 255 | |
| 256 | void luaE_freethread (lua_State *L, lua_State *L1) { |
no test coverage detected