From 9225e210c2bfe8e7be9664161a361f07dbfaf46e Mon Sep 17 00:00:00 2001 From: MishaTY <46088515+MishaTY@users.noreply.github.com> Date: Sat, 16 Jan 2021 15:44:56 -0500 Subject: [PATCH] Update InterlockedImpl.cs --- .../System/Threading/InterlockedImpl.cs | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/source/Cosmos.Core_Plugs/System/Threading/InterlockedImpl.cs b/source/Cosmos.Core_Plugs/System/Threading/InterlockedImpl.cs index 751e5909c..89929b89a 100644 --- a/source/Cosmos.Core_Plugs/System/Threading/InterlockedImpl.cs +++ b/source/Cosmos.Core_Plugs/System/Threading/InterlockedImpl.cs @@ -1,3 +1,4 @@ +using System; using System.Threading; using IL2CPU.API.Attribs; @@ -10,9 +11,62 @@ namespace Cosmos.Core_Plugs.System.Threading { return aData -= 1; } + public static long Decrement(ref long aData) + { + return aData -= 1; + } public static int Increment(ref int aData) { return aData += 1; } + public static long Increment(ref long aData) + { + return aData += 1; + } + public static int Exchange(ref int loc1, int aData) + { + int orgValue = loc1; + loc1 = aData; + return orgValue; + } + public static long Exchange(ref long loc1, long aData) + { + long orgValue = loc1; + loc1 = aData; + return orgValue; + } + public static float Exchange(ref float loc1, float aData) + { + float orgValue = loc1; + loc1 = aData; + return orgValue; + } + public static double Exchange(ref double loc1, double aData) + { + double orgValue = loc1; + loc1 = aData; + return orgValue; + } + public static Object Exchange(ref Object loc1, Object aData) + { + Object orgValue = loc1; + loc1 = aData; + return orgValue; + } + public static IntPtr Exchange(ref IntPtr loc1, IntPtr aData) + { + IntPtr orgValue = loc1; + loc1 = aData; + return orgValue; + } + public static EventHandler CompareExchange(ref EventHandler loc1, EventHandler val, EventHandler comparand) + { + EventHandler old = loc1; + if (loc1 == comparand) + { + loc1 = val; + } + return old; + } } }