From 7bf672fd0c6211909d94078b448032b1bd0916ef Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 23 Oct 2021 18:19:18 +0800 Subject: *misc --- Runtime/Lua/LuaBind/LuaBindVM.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Runtime/Lua/LuaBind/LuaBindVM.h') diff --git a/Runtime/Lua/LuaBind/LuaBindVM.h b/Runtime/Lua/LuaBind/LuaBindVM.h index a53a707..f3a9a30 100644 --- a/Runtime/Lua/LuaBind/LuaBindVM.h +++ b/Runtime/Lua/LuaBind/LuaBindVM.h @@ -30,6 +30,8 @@ namespace LuaBind void OpenLibs(); lua_State* GetMainThread(); + void SetCurThread(lua_State* cur); + lua_State* GetCurThread(); lua_State* CreateThread(); State GetMainState(); @@ -42,8 +44,9 @@ namespace LuaBind private: static std::map VMs; // 通过global_State索引虚拟机,为了方便 - global_State* mGlobalState; // 虚拟机的global_State,由当前虚拟机的所有线程共享,保存注册表、管理GC - lua_State* mMainThread; // 主线程 + global_State* mGlobalState; // 虚拟机的global_State,由当前虚拟机的所有线程共享,保存注册表、管理GC + lua_State* mMainThread; // 主线程 + lua_State* mCurThread; // 当前线程,并不是绝对准确的,在调用C函数时会设置,见LUA_BIND_STATE宏 RefTable mStrongRefTable; // 全局强引用表 RefTable mWeakRefTable; // 全局弱引用表 -- cgit v1.1-26-g67d0