Show / Hide Table of Contents

Class AtomicEnum

Provides basic atomic operations for arbitrary enum type.

Inheritance
Object
AtomicEnum
Namespace: DotNext.Threading
Assembly: DotNext.dll
Syntax
public static class AtomicEnum : object

Methods

| Improve this Doc View Source

VolatileRead<E>(ref E)

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 E VolatileRead<E>(this ref E value)

    where E : struct, Enum
Parameters
Type Name Description
E value

The field to read.

Returns
Type Description
E

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
E
| Improve this Doc View Source

VolatileWrite<E>(ref E, E)

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<E>(this ref E value, E newValue)

    where E : struct, Enum
Parameters
Type Name Description
E value

The field where the value is written.

E 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
E
  • Improve this Doc
  • View Source
Back to top Generated by DocFX