mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 14:02:19 +00:00
Update InterlockedImpl.cs
This commit is contained in:
parent
86dfa0879f
commit
9225e210c2
1 changed files with 54 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using IL2CPU.API.Attribs;
|
using IL2CPU.API.Attribs;
|
||||||
|
|
||||||
|
|
@ -10,9 +11,62 @@ namespace Cosmos.Core_Plugs.System.Threading
|
||||||
{
|
{
|
||||||
return aData -= 1;
|
return aData -= 1;
|
||||||
}
|
}
|
||||||
|
public static long Decrement(ref long aData)
|
||||||
|
{
|
||||||
|
return aData -= 1;
|
||||||
|
}
|
||||||
public static int Increment(ref int aData)
|
public static int Increment(ref int aData)
|
||||||
{
|
{
|
||||||
return aData += 1;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue