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 SourceCompareExchange(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 |
Returns
Type | Description |
---|---|
T | The original value in |
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. |
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. |