DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="4.9.0" />

 AtomicIntPtr

public static class AtomicIntPtr
Various atomic operations for IntPtr data type accessible as extension methods.
public static IntPtr AccumulateAndGet(this ref IntPtr value, IntPtr x, Func<IntPtr, IntPtr, IntPtr> accumulator)

Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.

public static IntPtr AccumulateAndGet(this ref IntPtr value, IntPtr x, method accumulator)

public static IntPtr AddAndGet(this ref IntPtr value, IntPtr operand)

Adds two native integers and replaces referenced storage with the sum, as an atomic operation.

public static IntPtr BitwiseAndAndGet(this ref IntPtr value, IntPtr operand)

Bitwise "ands" two native integers and replaces referenced integer with the result, as an atomic operation.

public static IntPtr BitwiseOrAndGet(this ref IntPtr value, IntPtr operand)

Bitwise "ors" two native integers and replaces referenced integer with the result, as an atomic operation.

public static IntPtr BitwiseXorAndGet(this ref IntPtr value, IntPtr operand)

Bitwise "xors" two native integers and replaces referenced integer with the result, as an atomic operation.

public static bool CompareAndSet(this ref IntPtr value, IntPtr expected, IntPtr update)

Atomically sets the referenced value to the given updated value if the current value == the expected value.

public static IntPtr DecrementAndGet(this ref IntPtr value)

Atomically decrements the referenced value by one.

public static IntPtr GetAndAccumulate(this ref IntPtr value, IntPtr x, Func<IntPtr, IntPtr, IntPtr> accumulator)

Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.

public static IntPtr GetAndAccumulate(this ref IntPtr value, IntPtr x, method accumulator)

public static IntPtr GetAndAdd(this ref IntPtr value, IntPtr operand)

Adds two native integers and replaces referenced integer with the sum, as an atomic operation.

public static IntPtr GetAndBitwiseAnd(this ref IntPtr value, IntPtr operand)

Bitwise "ands" two native integers and replaces referenced integer with the result, as an atomic operation.

public static IntPtr GetAndBitwiseOr(this ref IntPtr value, IntPtr operand)

Bitwise "ors" two native integers and replaces referenced integer with the result, as an atomic operation.

public static IntPtr GetAndBitwiseXor(this ref IntPtr value, IntPtr operand)

Bitwise "xors" two native integers and replaces referenced integer with the result, as an atomic operation.

public static IntPtr GetAndSet(this ref IntPtr value, IntPtr update)

Modifies the referenced value atomically.

public static IntPtr GetAndUpdate(this ref IntPtr value, Func<IntPtr, IntPtr> updater)

Atomically updates the stored value with the results of applying the given function, returning the original value.

public static IntPtr GetAndUpdate(this ref IntPtr value, method updater)

public static IntPtr IncrementAndGet(this ref IntPtr value)

Atomically increments the referenced value by one.

public static IntPtr SetAndGet(this ref IntPtr value, IntPtr update)

Modifies the referenced value atomically.

public static IntPtr UpdateAndGet(this ref IntPtr value, Func<IntPtr, IntPtr> updater)

Atomically updates the stored value with the results of applying the given function, returning the updated value.

public static IntPtr UpdateAndGet(this ref IntPtr value, method updater)

public static IntPtr VolatileRead(this ref IntPtr value)

Reads the value of the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears after this method in the code, the processor cannot move it before this method.

public static void VolatileWrite(this ref IntPtr value, IntPtr newValue)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.