class Interlocked

in global :: System . Threading

Provides atomic operations for variables that are shared by multiple threads.


public static int Add( ref int location1, int value )

Adds two 32-bit integers and replaces the first integer with the sum, as an atomic operation.

  • location1 A variable containing the first value to be added. The sum of the two values is stored in .
  • value The value to be added to the integer at .
  • Returns The new value stored at .

public static long Add( ref long location1, long value )

Adds two 64-bit integers and replaces the first integer with the sum, as an atomic operation.

  • location1 A variable containing the first value to be added. The sum of the two values is stored in .
  • value The value to be added to the integer at .
  • Returns The new value stored at .

public static double CompareExchange( ref double location1, double value, double comparand )

Compares two double-precision floating point numbers for equality and, if they are equal, replaces the first value.

  • location1 The destination, whose value is compared with and possibly replaced.
  • value The value that replaces the destination value if the comparison results in equality.
  • comparand The value that is compared to the value at .
  • Returns The original value in .

public static int CompareExchange( ref int location1, int value, int comparand )

Compares two 32-bit signed integers for equality and, if they are equal, replaces the first value.

  • location1 The destination, whose value is compared with and possibly replaced.
  • value The value that replaces the destination value if the comparison results in equality.
  • comparand The value that is compared to the value at .
  • Returns The original value in .

public static long CompareExchange( ref long location1, long value, long comparand )

Compares two 64-bit signed integers for equality and, if they are equal, replaces the first value.

  • location1 The destination, whose value is compared with and possibly replaced.
  • value The value that replaces the destination value if the comparison results in equality.
  • comparand The value that is compared to the value at .
  • Returns The original value in .

public static IntPtr CompareExchange( ref IntPtr location1, IntPtr value, IntPtr comparand )

Compares two platform-specific handles or pointers for equality and, if they are equal, replaces the first one.

  • location1 The destination , whose value is compared with the value of and possibly replaced by .
  • value The that replaces the destination value if the comparison results in equality.
  • comparand The that is compared to the value at .
  • Returns The original value in .

public static object CompareExchange( ref object location1, object value, object comparand )

Compares two objects for reference equality and, if they are equal, replaces the first object.

  • location1 The destination object that is compared by reference with and possibly replaced.
  • value The object that replaces the destination object if the reference comparison results in equality.
  • comparand The object that is compared by reference to the object at .
  • Returns The original value in .

public static float CompareExchange( ref float location1, float value, float comparand )

Compares two single-precision floating point numbers for equality and, if they are equal, replaces the first value.

  • location1 The destination, whose value is compared with and possibly replaced.
  • value The value that replaces the destination value if the comparison results in equality.
  • comparand The value that is compared to the value at .
  • Returns The original value in .

public static int Decrement( ref int location )

Decrements a specified variable and stores the result, as an atomic operation.

  • location The variable whose value is to be decremented.
  • Returns The decremented value.

public static long Decrement( ref long location )

Decrements the specified variable and stores the result, as an atomic operation.

  • location The variable whose value is to be decremented.
  • Returns The decremented value.

public static double Exchange( ref double location1, double value )

Sets a double-precision floating point number to a specified value and returns the original value, as an atomic operation.

  • location1 The variable to set to the specified value.
  • value The value to which the parameter is set.
  • Returns The original value of .

public static int Exchange( ref int location1, int value )

Sets a 32-bit signed integer to a specified value and returns the original value, as an atomic operation.

  • location1 The variable to set to the specified value.
  • value The value to which the parameter is set.
  • Returns The original value of .

public static long Exchange( ref long location1, long value )

Sets a 64-bit signed integer to a specified value and returns the original value, as an atomic operation.

  • location1 The variable to set to the specified value.
  • value The value to which the parameter is set.
  • Returns The original value of .

public static IntPtr Exchange( ref IntPtr location1, IntPtr value )

Sets a platform-specific handle or pointer to a specified value and returns the original value, as an atomic operation.

  • location1 The variable to set to the specified value.
  • value The value to which the parameter is set.
  • Returns The original value of .

public static object Exchange( ref object location1, object value )

Sets an object to a specified value and returns a reference to the original object, as an atomic operation.

  • location1 The variable to set to the specified value.
  • value The value to which the parameter is set.
  • Returns The original value of .

public static float Exchange( ref float location1, float value )

Sets a single-precision floating point number to a specified value and returns the original value, as an atomic operation.

  • location1 The variable to set to the specified value.
  • value The value to which the parameter is set.
  • Returns The original value of .

public static int Increment( ref int location )

Increments a specified variable and stores the result, as an atomic operation.

  • location The variable whose value is to be incremented.
  • Returns The incremented value.

public static long Increment( ref long location )

Increments a specified variable and stores the result, as an atomic operation.

  • location The variable whose value is to be incremented.
  • Returns The incremented value.

public static long Read( ref long location )

Returns a 64-bit value, loaded as an atomic operation.

  • location The 64-bit value to be loaded.
  • Returns The loaded value.

public static long Or( ref long location1, long value )

😔 No documentation found.

public static UIntPtr CompareExchange( ref UIntPtr location1, UIntPtr value, UIntPtr comparand )

😔 No documentation found.

public static T CompareExchange( ref T location1, T value, T comparand )

😔 No documentation found.

public static uint Add( ref uint location1, uint value )

😔 No documentation found.

public static ulong Add( ref ulong location1, ulong value )

😔 No documentation found.

public static ulong Read( ref ulong location )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public static int And( ref int location1, int value )

😔 No documentation found.

public static uint And( ref uint location1, uint value )

😔 No documentation found.

public static long And( ref long location1, long value )

😔 No documentation found.

public static ulong And( ref ulong location1, ulong value )

😔 No documentation found.

public static int Or( ref int location1, int value )

😔 No documentation found.

public static uint Or( ref uint location1, uint value )

😔 No documentation found.

public static ulong Or( ref ulong location1, ulong value )

😔 No documentation found.

public static void MemoryBarrier( )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public static UIntPtr Exchange( ref UIntPtr location1, UIntPtr value )

😔 No documentation found.

public static void MemoryBarrierProcessWide( )

😔 No documentation found.

public static uint Increment( ref uint location )

😔 No documentation found.

public static ulong Increment( ref ulong location )

😔 No documentation found.

public static uint Decrement( ref uint location )

😔 No documentation found.

public static ulong Decrement( ref ulong location )

😔 No documentation found.

public static sbyte Exchange( ref sbyte location1, sbyte value )

😔 No documentation found.

public static short Exchange( ref short location1, short value )

😔 No documentation found.

public static byte Exchange( ref byte location1, byte value )

😔 No documentation found.

public static ushort Exchange( ref ushort location1, ushort value )

😔 No documentation found.

public static uint Exchange( ref uint location1, uint value )

😔 No documentation found.

public static ulong Exchange( ref ulong location1, ulong value )

😔 No documentation found.

public bool Equals( object obj )

😔 No documentation found.

public static T Exchange( ref T location1, T value )

😔 No documentation found.

public static sbyte CompareExchange( ref sbyte location1, sbyte value, sbyte comparand )

😔 No documentation found.

public static short CompareExchange( ref short location1, short value, short comparand )

😔 No documentation found.

public static byte CompareExchange( ref byte location1, byte value, byte comparand )

😔 No documentation found.

public static ushort CompareExchange( ref ushort location1, ushort value, ushort comparand )

😔 No documentation found.

public static ulong CompareExchange( ref ulong location1, ulong value, ulong comparand )

😔 No documentation found.

public static uint CompareExchange( ref uint location1, uint value, uint comparand )

😔 No documentation found.