From cee712105850ac3385cd0091a923438167433f9f Mon Sep 17 00:00:00 2001 From: TSR Berry <20988865+TSRBerry@users.noreply.github.com> Date: Sat, 8 Apr 2023 01:22:00 +0200 Subject: Move solution and projects to src --- src/Ryujinx.Common/Pools/ThreadStaticArray.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/Ryujinx.Common/Pools/ThreadStaticArray.cs (limited to 'src/Ryujinx.Common/Pools/ThreadStaticArray.cs') diff --git a/src/Ryujinx.Common/Pools/ThreadStaticArray.cs b/src/Ryujinx.Common/Pools/ThreadStaticArray.cs new file mode 100644 index 00000000..21434a02 --- /dev/null +++ b/src/Ryujinx.Common/Pools/ThreadStaticArray.cs @@ -0,0 +1,20 @@ +using System; + +namespace Ryujinx.Common.Pools +{ + public static class ThreadStaticArray + { + [ThreadStatic] + private static T[] _array; + + public static ref T[] Get() + { + if (_array == null) + { + _array = new T[1]; + } + + return ref _array; + } + } +} -- cgit v1.2.3