From 8d2a2cd5de40e2b94ef5007c32832ed9a063dc40 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Thu, 12 Oct 2023 22:09:49 +0800 Subject: +hazel-networking --- Tools/Hazel-Networking/Hazel/IRecyclable.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Tools/Hazel-Networking/Hazel/IRecyclable.cs (limited to 'Tools/Hazel-Networking/Hazel/IRecyclable.cs') diff --git a/Tools/Hazel-Networking/Hazel/IRecyclable.cs b/Tools/Hazel-Networking/Hazel/IRecyclable.cs new file mode 100644 index 0000000..3e9769e --- /dev/null +++ b/Tools/Hazel-Networking/Hazel/IRecyclable.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Hazel +{ + /// + /// Interface for all items that can be returned to an object pool. + /// + /// + public interface IRecyclable + { + /// + /// Returns this object back to the object pool. + /// + /// + /// + /// Calling this when you are done with the object returns the object back to a pool in order to be reused. + /// This can reduce the amount of work the GC has to do dramatically but it is optional to call this. + /// + /// + /// Calling this indicates to Hazel that this can be reused and thus you should only call this when you are + /// completely finished with the object as the contents can be overwritten at any point after. + /// + /// + void Recycle(); + } +} -- cgit v1.1-26-g67d0