From d34e5c9d7c6135e805f2cc231411cdcc9910190c Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 8 Dec 2018 11:53:02 +0800 Subject: *misc --- src/lua/common/je_lua_object.cpp | 2 +- src/lua/common/je_lua_object.h | 2 +- src/lua/common/je_lua_runtime.cpp | 2 +- src/lua/common/je_lua_shared.hpp | 10 ++++++---- 4 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/lua/common') diff --git a/src/lua/common/je_lua_object.cpp b/src/lua/common/je_lua_object.cpp index d98099e..de3270a 100644 --- a/src/lua/common/je_lua_object.cpp +++ b/src/lua/common/je_lua_object.cpp @@ -38,7 +38,7 @@ namespace JinEngine return object->getType(); } - SharedBase* LuaObject::getSharedBase() + SharedBase* LuaObject::getShared() { return object; } diff --git a/src/lua/common/je_lua_object.h b/src/lua/common/je_lua_object.h index 15fa6e4..296ee03 100644 --- a/src/lua/common/je_lua_object.h +++ b/src/lua/common/je_lua_object.h @@ -23,7 +23,7 @@ namespace JinEngine const char* getObjectType(); - SharedBase* getSharedBase(); + SharedBase* getShared(); template Shared& getShared() diff --git a/src/lua/common/je_lua_runtime.cpp b/src/lua/common/je_lua_runtime.cpp index 73f671c..055073d 100644 --- a/src/lua/common/je_lua_runtime.cpp +++ b/src/lua/common/je_lua_runtime.cpp @@ -54,7 +54,7 @@ namespace JinEngine luax_copyinstance(to, luaObj); luax_pop(to, 1); // Pop reference object. } - SharedBase * shr = src->getSharedBase(); + SharedBase * shr = src->getShared(); LuaObject* obj = luax_newinstance(to, src->getObjectType(), shr); (*obj->dependencies) = (*src->dependencies); // Add to objects_table. diff --git a/src/lua/common/je_lua_shared.hpp b/src/lua/common/je_lua_shared.hpp index f89783d..86ee9be 100644 --- a/src/lua/common/je_lua_shared.hpp +++ b/src/lua/common/je_lua_shared.hpp @@ -29,10 +29,12 @@ namespace JinEngine SharedBase(const SharedBase&); - // 在同一个线程的lua_State中,LuaObject和EngineObject应该是一一对应,由LuaObject(lua runtime)管理引用计数和 - // 回收。Engine-side引用计数是为了维护不同线程的lua_State共享同一个EngineObject。每次由LuaObject绑定一个 - // Shared时就增加一个引用计数,理论上在同一个线程中,一个EngineObject只能由一个LuaObject绑定,发生在new - // instance过程中,那么mCount就表明EngineObject的共享线程数。 + /// + /// 在同一个线程的lua_State中,LuaObject和EngineObject应该是一一对应,由LuaObject(lua runtime)管理引用计数 + /// 和回收。Engine-side引用计数是为了维护不同线程的lua_State共享同一个EngineObject。每次由LuaObject绑定一个 + /// Shared时就增加一个引用计数,理论上在同一个线程中,一个EngineObject只能由一个LuaObject绑定,发生在new + /// instance过程中,那么mCount就表明EngineObject的共享线程数。 + /// void retain(); void release(); -- cgit v1.1-26-g67d0