summaryrefslogtreecommitdiff
path: root/source/3rd-party/Luax/luax_vm.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/3rd-party/Luax/luax_vm.h')
-rw-r--r--source/3rd-party/Luax/luax_vm.h34
1 files changed, 19 insertions, 15 deletions
diff --git a/source/3rd-party/Luax/luax_vm.h b/source/3rd-party/Luax/luax_vm.h
index 9039a04..1bac71e 100644
--- a/source/3rd-party/Luax/luax_vm.h
+++ b/source/3rd-party/Luax/luax_vm.h
@@ -7,6 +7,7 @@
#include "luax_ref.h"
#include "luax_config.h"
#include "luax_state.h"
+#include "luax_globalstate.h"
namespace Luax
{
@@ -17,38 +18,41 @@ namespace Luax
class LuaxVM
{
public:
+
+ ///
+ /// global_Stateõ
+ ///
+ static LuaxVM* TryGetVM(global_State* gState);
+ static LuaxVM* TryGetVM(lua_State* state);
+
LuaxVM();
~LuaxVM();
+ ///
+ /// ҪֶSetupʼһЩ״̬
+ ///
void Setup();
- lua_State* CreateThread();
lua_State* GetMainThread();
-
- int GetThreadCount();
+ lua_State* CreateThread();
LuaxRefTable& GetStrongRefTable();
LuaxRefTable& GetWeakRefTable();
- bool HasThread(lua_State* L);
-
- static LuaxVM* TryGetVM(lua_State* L);
-
- typedef std::map<lua_State*, LuaxVM*> ThreadMap;
-
private:
- static ThreadMap threadMap; // ̲ͨ߳Ϊ˷
+ typedef std::map<global_State*, LuaxVM*> VMap;
- LuaxRefTable mStrongRefTable; // _LUAX_STRONGREF_TABLE
- LuaxRefTable mWeakRefTable; // _LUAX_WEAKREF_TABLE
+ static VMap VMs; // ͨglobal_StateΪ˷
- lua_State* mMainThread; // ߳
+ LuaxRefTable mStrongRefTable; // _LUAX_STRONGREF_TABLE
+ LuaxRefTable mWeakRefTable; // _LUAX_WEAKREF_TABLE
- std::unordered_set<lua_State*> mThreads; // ߳
+ global_State* mGlobalState; // global_Stateɵǰ̹߳
+ lua_State* mMainThread; // ߳
#if LUAX_PROFILER
- size_t mObjectCount; // ͳڴдʵ
+ size_t mObjectCount; // ͳڴдʵ
#endif
};