Show / Hide Table of Contents

Class AtomicEnum

Provides basic atomic operations for arbitrary enum type.

Inheritance
Object
AtomicEnum
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: DotNext.Threading
Assembly: DotNext.dll
Syntax
public static class AtomicEnum

Methods

| Improve this Doc View Source

VolatileRead<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.

| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX