Search Results for

    Show / Hide Table of Contents

    Class AtomicReference<T>

    Implementation of the java.concurrent.util AtomicReference type.

    Uses Volatile internally to enforce ordering of writes without any explicit locking. .NET's strong memory on write guarantees might already enforce this ordering, but the addition of the Volatile guarantees it.

    Inheritance
    object
    AtomicReference<T>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Util
    Assembly: Akka.dll
    Syntax
    public class AtomicReference<T> where T : class
    Type Parameters
    Name Description
    T

    The type of object referenced by this instance.

    Constructors

    | Edit this page View Source

    AtomicReference()

    Default constructor

    Declaration
    public AtomicReference()
    | Edit this page View Source

    AtomicReference(T)

    Sets the initial value of this AtomicReference<T> to originalValue.

    Declaration
    public AtomicReference(T originalValue)
    Parameters
    Type Name Description
    T originalValue

    The initial value to be referenced.

    Fields

    | Edit this page View Source

    atomicValue

    The internal field that holds the referenced value.

    Declaration
    protected T atomicValue
    Field Value
    Type Description
    T

    Properties

    | Edit this page View Source

    Value

    The current value of this AtomicReference<T>

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

    Methods

    | Edit this page View Source

    CompareAndSet(T, T)

    If Value equals expected, then set the Value to newValue.

    Declaration
    public bool CompareAndSet(T expected, T newValue)
    Parameters
    Type Name Description
    T expected

    The value expected to be referenced currently.

    T newValue

    The new value to reference if the current matches the expected value.

    Returns
    Type Description
    bool

    true if newValue was set

    | Edit this page View Source

    GetAndSet(T)

    Atomically sets the Value to newValue and returns the old Value.

    Declaration
    public T GetAndSet(T newValue)
    Parameters
    Type Name Description
    T newValue

    The new value

    Returns
    Type Description
    T

    The old value

    Operators

    | Edit this page View Source

    implicit operator T(AtomicReference<T>)

    Performs an implicit conversion from AtomicReference<T> to T.

    Declaration
    public static implicit operator T(AtomicReference<T> atomicReference)
    Parameters
    Type Name Description
    AtomicReference<T> atomicReference

    The reference to convert

    Returns
    Type Description
    T

    The result of the conversion.

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET