增加 获取当前线程ID

This commit is contained in:
baidwwy 2021-04-14 07:18:39 +08:00
parent b91c3f23ff
commit 10a186f7f4
2 changed files with 11 additions and 6 deletions

View File

@ -127,6 +127,11 @@
////SDL_TLSCreate
////SDL_TLSGet
////SDL_TLSSet
static int LUA_ThreadID(lua_State* L)
{
lua_pushinteger(L, SDL_ThreadID());
return 1;
}
//static const luaL_Reg thread_funcs[] = {
// {"GetThreadName" , LUA_GetThreadName} ,
// {"GetThreadID" , LUA_GetThreadID} ,
@ -136,10 +141,11 @@
// { NULL, NULL}
//};
//
//static const luaL_Reg sdl_funcs[] = {
// {"CreateThread" , LUA_CreateThread} ,
// { NULL, NULL}
//};
static const luaL_Reg sdl_funcs[] = {
//{"CreateThread" , LUA_CreateThread} ,
{"ThreadID" , LUA_ThreadID} ,
{ NULL, NULL}
};
int bind_thread(lua_State *L)
{
@ -149,6 +155,6 @@ int bind_thread(lua_State *L)
//lua_setfield(L, -2, "__index");
//lua_pop(L, 1);
//luaL_setfuncs(L,sdl_funcs,0);
luaL_setfuncs(L,sdl_funcs,0);
return 0;
}

View File

@ -78,7 +78,6 @@ static int LUA_RemoveTimer(lua_State* L)
*ud = NULL;
return 1;
}
return 0;
}