From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XUtliPoolLib/HashPool.cs | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Client/Assets/Scripts/XUtliPoolLib/HashPool.cs (limited to 'Client/Assets/Scripts/XUtliPoolLib/HashPool.cs') diff --git a/Client/Assets/Scripts/XUtliPoolLib/HashPool.cs b/Client/Assets/Scripts/XUtliPoolLib/HashPool.cs new file mode 100644 index 00000000..2c9f5a1b --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/HashPool.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; + +namespace XUtliPoolLib +{ + public class HashPool + { + private static readonly ObjectPool> s_Pool = new ObjectPool>(new ObjectPool>.CreateObj(HashPool.Create), delegate(HashSet l) + { + l.Clear(); + }, delegate(HashSet l) + { + l.Clear(); + }); + + public static HashSet Create() + { + return new HashSet(); + } + + public static HashSet Get() + { + return HashPool.s_Pool.Get(); + } + + public static void Release(HashSet toRelease) + { + HashPool.s_Pool.Release(toRelease); + } + } +} -- cgit v1.1-26-g67d0