diff options
author | chai <chaifix@163.com> | 2021-10-23 18:19:18 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-23 18:19:18 +0800 |
commit | 7bf672fd0c6211909d94078b448032b1bd0916ef (patch) | |
tree | 655b875b81ec8d0559ca905fb7d37a1d88e6a80d /Runtime/Lua/LuaBind/LuaBindVM.h | |
parent | df0444f85f9bf623cc886e1632e624ef20cb0f1b (diff) |
*misc
Diffstat (limited to 'Runtime/Lua/LuaBind/LuaBindVM.h')
-rw-r--r-- | Runtime/Lua/LuaBind/LuaBindVM.h | 7 |
1 files changed, 5 insertions, 2 deletions
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<global_State*, VM*> 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; // 全局弱引用表 |