From d29f5f4aebd90b1e256967801b28a5990249b2e7 Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 16 Mar 2019 19:29:23 +0800 Subject: *luax --- Source/Asura.Engine/scripting/portable.hpp | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Source/Asura.Engine/scripting/portable.hpp (limited to 'Source/Asura.Engine/scripting/portable.hpp') diff --git a/Source/Asura.Engine/scripting/portable.hpp b/Source/Asura.Engine/scripting/portable.hpp new file mode 100644 index 0000000..773e7ad --- /dev/null +++ b/Source/Asura.Engine/scripting/portable.hpp @@ -0,0 +1,43 @@ +#ifndef __ASURA_ENGINE_PORTABLE_H__ +#define __ASURA_ENGINE_PORTABLE_H__ + +#include "Config.h" +#include "Luax.hpp" +#include "Type.h" + +namespace AsuraEngine +{ + namespace Scripting + { + + template + class Portable : public Luax::LuaxClass + { + public: + + Portable(); + virtual ~Portable(); + + void Retain(); + void Release(); + + private: + + /// + /// 多线程保护,lua调用gc后,如果在其他线程用了此native object,不会调用delete。 + /// + int mRefCount; + + /// + /// delete保险,继承portable的类,无法使用delete,只能使用Release。 + /// + bool mSafer; + + }; + +#include "portable.inl" + + } +} + +#endif \ No newline at end of file -- cgit v1.1-26-g67d0