summaryrefslogtreecommitdiff
path: root/Runtime/Scripting/luax_watchdog.h
blob: b07b00729c248849a12dd70a3dbda95beaa1da02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef __LUAX_DOG_H__
#define __LUAX_DOG_H__

#include "luax_config.h"

namespace Luax
{

	///
	/// LuaxNativeClass实例的引用计数额watch dog,只有在watch dog通过时才可以delete。
	///
	class LuaxWatchDog
	{
	public: 
		LuaxWatchDog()
			: mVMRef(0)
			, mNativeRef(0)
		{
		}

		inline operator bool()
		{
			return mVMRef == 0 && mNativeRef == 0;
		}

		uint mVMRef;     // 托管给的虚拟机数
		uint mNativeRef; // 本地引用数

	};

}

#endif