Class AtomicEnum
Provides basic atomic operations for arbitrary enum type.
Inherited Members
Namespace: DotNext.Threading
Assembly: DotNext.dll
Syntax
public static class AtomicEnum
Methods
| Improve this Doc View SourceVolatileRead<TEnum>(ref TEnum)
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.
Declaration
public static TEnum VolatileRead<TEnum>(this ref TEnum value)
where TEnum : struct, Enum
Parameters
Type | Name | Description |
---|---|---|
TEnum | value | The field to read. |
Returns
Type | Description |
---|---|
TEnum | The value that was read. This value is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache. |
Type Parameters
Name | Description |
---|---|
TEnum | The enum type. |
VolatileWrite<TEnum>(ref TEnum, TEnum)
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.
Declaration
public static void VolatileWrite<TEnum>(this ref TEnum value, TEnum newValue)
where TEnum : struct, Enum
Parameters
Type | Name | Description |
---|---|---|
TEnum | value | The field where the value is written. |
TEnum | newValue | The value to write. The value is written immediately so that it is visible to all processors in the computer. |
Type Parameters
Name | Description |
---|---|
TEnum | The enum type. |