Show / Hide Table of Contents

Struct AtomicEnum<E>

Represents atomic enum value.

Implements
IEquatable<E>
ISerializable
Namespace: DotNext.Threading
Assembly: DotNext.dll
Syntax
public struct AtomicEnum<E> : IEquatable<E>, ISerializable where E : struct, Enum
Type Parameters
Name Description
E

Constructors

| Improve this Doc View Source

AtomicEnum(E)

Initializes a new atomic boolean container with initial value.

Declaration
public AtomicEnum(E value)
Parameters
Type Name Description
E value

Initial value of the atomic boolean.

Properties

| Improve this Doc View Source

Value

Gets or sets enum value in volatile manner.

Declaration
public E Value { get; set; }
Property Value
Type Description
E

Methods

| Improve this Doc View Source

AccumulateAndGet(E, Func<E, E, E>)

Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.

Declaration
public E AccumulateAndGet(E x, Func<E, E, E> accumulator)
Parameters
Type Name Description
E x

Accumulator operand.

DotNext.Func<E, E, E> accumulator

A side-effect-free function of two arguments

Returns
Type Description
E

The updated value.

Remarks

The function is applied with the current value as its first argument, and the given update as the second argument.

| Improve this Doc View Source

AccumulateAndGet(E, ValueFunc<E, E, E>)

Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.

Declaration
public E AccumulateAndGet(E x, in ValueFunc<E, E, E> accumulator)
Parameters
Type Name Description
E x

Accumulator operand.

ValueFunc<E, E, E> accumulator

A side-effect-free function of two arguments

Returns
Type Description
E

The updated value.

Remarks

The function is applied with the current value as its first argument, and the given update as the second argument.

| Improve this Doc View Source

CompareAndSet(E, E)

Atomically sets referenced value to the given updated value if the current value == the expected value.

Declaration
public bool CompareAndSet(E expected, E update)
Parameters
Type Name Description
E expected

The expected value.

E update

The new value.

Returns
Type Description
Boolean

true if successful. false return indicates that the actual value was not equal to the expected value.

| Improve this Doc View Source

CompareExchange(E, E)

Atomically sets referenced value to the given updated value if the current value == the expected value.

Declaration
public E CompareExchange(E update, E expected)
Parameters
Type Name Description
E update

The new value.

E expected

The expected value.

Returns
Type Description
E

The original value.

| Improve this Doc View Source

Equals(E)

Determines whether stored value is equal to value passed as argument.

Declaration
public bool Equals(E other)
Parameters
Type Name Description
E other

Other value to compare.

Returns
Type Description
Boolean

true, if stored value is equal to other value; otherwise, false.

| Improve this Doc View Source

Equals(Object)

Determines whether stored value is equal to value as the passed argument.

Declaration
public override bool Equals(object other)
Parameters
Type Name Description
Object other

Other value to compare.

Returns
Type Description
Boolean

true, if stored value is equal to other value; otherwise, false.

| Improve this Doc View Source

GetAndAccumulate(E, Func<E, E, E>)

Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.

Declaration
public E GetAndAccumulate(E x, Func<E, E, E> accumulator)
Parameters
Type Name Description
E x

Accumulator operand.

DotNext.Func<E, E, E> accumulator

A side-effect-free function of two arguments

Returns
Type Description
E

The original value.

Remarks

The function is applied with the current value as its first argument, and the given update as the second argument.

| Improve this Doc View Source

GetAndAccumulate(E, ValueFunc<E, E, E>)

Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.

Declaration
public E GetAndAccumulate(E x, in ValueFunc<E, E, E> accumulator)
Parameters
Type Name Description
E x

Accumulator operand.

ValueFunc<E, E, E> accumulator

A side-effect-free function of two arguments

Returns
Type Description
E

The original value.

Remarks

The function is applied with the current value as its first argument, and the given update as the second argument.

| Improve this Doc View Source

GetAndSet(E)

Modifies the current value atomically.

Declaration
public E GetAndSet(E update)
Parameters
Type Name Description
E update

A new value to be stored into this container.

Returns
Type Description
E

Original value before modification.

| Improve this Doc View Source

GetAndUpdate(Func<E, E>)

Atomically updates the stored value with the results of applying the given function, returning the original value.

Declaration
public E GetAndUpdate(Func<E, E> updater)
Parameters
Type Name Description
DotNext.Func<E, E> updater

A side-effect-free function

Returns
Type Description
E

The original value.

| Improve this Doc View Source

GetAndUpdate(ValueFunc<E, E>)

Atomically updates the stored value with the results of applying the given function, returning the original value.

Declaration
public E GetAndUpdate(in ValueFunc<E, E> updater)
Parameters
Type Name Description
ValueFunc<E, E> updater

A side-effect-free function

Returns
Type Description
E

The original value.

| Improve this Doc View Source

GetHashCode()

Computes hash code for the stored value.

Declaration
public override int GetHashCode()
Returns
Type Description
Int32

The hash code of the stored boolean value.

| Improve this Doc View Source

SetAndGet(E)

Modifies the current value atomically.

Declaration
public E SetAndGet(E update)
Parameters
Type Name Description
E update

A new value to be stored into this container.

Returns
Type Description
E

A new value passed as argument.

| Improve this Doc View Source

UpdateAndGet(Func<E, E>)

Atomically updates the stored value with the results of applying the given function, returning the updated value.

Declaration
public E UpdateAndGet(Func<E, E> updater)
Parameters
Type Name Description
DotNext.Func<E, E> updater

A side-effect-free function

Returns
Type Description
E

The updated value.

| Improve this Doc View Source

UpdateAndGet(ValueFunc<E, E>)

Atomically updates the stored value with the results of applying the given function, returning the updated value.

Declaration
public E UpdateAndGet(in ValueFunc<E, E> updater)
Parameters
Type Name Description
ValueFunc<E, E> updater

A side-effect-free function

Returns
Type Description
E

The updated value.

Implements

IEquatable<>
ISerializable

Extension Methods

ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX