Show / Hide Table of Contents

Interface IInterlockedOperations<T>

Represents interlocked operations.

Namespace: DotNext.Threading
Assembly: DotNext.dll
Syntax
public interface IInterlockedOperations<T>
Type Parameters
Name Description
T

The type that supports interlocked operations.

Methods

| Edit this page View Source

CompareExchange(ref T, T, T)

Compares two values for equality and, if they are equal, replaces the first value.

Declaration
public static abstract T CompareExchange(ref T location, T value, T comparand)
Parameters
Type Name Description
T location

The destination, whose value is compared with comparand and possibly replaced.

T value

The value that replaces the destination value if the comparison results in equality.

T comparand

The value that is compared to the value at location.

Returns
Type Description
T

The original value in location.

| Edit this page View Source

VolatileRead(ref readonly T)

Reads the value of the specified location. 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.

Declaration
public static abstract T VolatileRead(ref readonly T location)
Parameters
Type Name Description
T location

The location of the value.

Returns
Type Description
T

The value that was read.

| Edit this page View Source

VolatileWrite(ref T, T)

Writes the specified value to the specified location. 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.

Declaration
public static abstract void VolatileWrite(ref T location, T value)
Parameters
Type Name Description
T location

The location of the value.

T value

The value to write.

  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾