Search Results for

    Show / Hide Table of Contents

    Class AtomicCounterLong

    An atomic 64 bit integer counter.

    Inheritance
    object
    AtomicCounterLong
    Implements
    IAtomicCounter<long>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Akka.Util.Internal
    Assembly: Akka.dll
    Syntax
    public class AtomicCounterLong : IAtomicCounter<long>

    Constructors

    | Edit this page View Source

    AtomicCounterLong()

    Creates an instance of an AtomicCounterLong with a starting value of -1.

    Declaration
    public AtomicCounterLong()
    | Edit this page View Source

    AtomicCounterLong(long)

    Creates an instance of an AtomicCounterLong.

    Declaration
    public AtomicCounterLong(long value)
    Parameters
    Type Name Description
    long value

    The initial value of this counter.

    Properties

    | Edit this page View Source

    Current

    Retrieves the current value of the counter

    Declaration
    public long Current { get; }
    Property Value
    Type Description
    long

    Methods

    | Edit this page View Source

    AddAndGet(long)

    Adds an amount to the counter and returns the new value.

    Declaration
    public long AddAndGet(long amount)
    Parameters
    Type Name Description
    long amount

    The amount to add to the counter.

    Returns
    Type Description
    long

    The new counter value.

    Remarks

    This uses a CAS loop as Interlocked.Increment is not atomic for longs on 32bit systems.

    | Edit this page View Source

    CompareAndSet(long, long)

    Compares current counter value with provided expected value, and sets it to newValue if compared values where equal. Returns true if replacement has succeed.

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

    TBD

    long newValue

    TBD

    Returns
    Type Description
    bool

    TBD

    | Edit this page View Source

    DecrementAndGet()

    Atomically decrements the counter by one

    Declaration
    public long DecrementAndGet()
    Returns
    Type Description
    long

    The new value

    | Edit this page View Source

    GetAndAdd(long)

    Gets the current value of the counter and adds an amount to it.

    Declaration
    public long GetAndAdd(long amount)
    Parameters
    Type Name Description
    long amount

    The amount to add to the counter.

    Returns
    Type Description
    long

    The original value.

    Remarks

    This uses a CAS loop as Interlocked.Increment is not atomic for longs on 32bit systems.

    | Edit this page View Source

    GetAndIncrement()

    Atomically increments the counter by one.

    Declaration
    public long GetAndIncrement()
    Returns
    Type Description
    long

    The original value.

    | Edit this page View Source

    GetAndSet(long)

    Returns current counter value and sets a new value on it's place in one operation.

    Declaration
    public long GetAndSet(long value)
    Parameters
    Type Name Description
    long value

    TBD

    Returns
    Type Description
    long

    TBD

    | Edit this page View Source

    IncrementAndGet()

    Atomically increments the counter by one.

    Declaration
    public long IncrementAndGet()
    Returns
    Type Description
    long

    The new value.

    | Edit this page View Source

    Next()

    Increments the counter and returns the next value.

    Declaration
    public long Next()
    Returns
    Type Description
    long

    TBD

    | Edit this page View Source

    Reset()

    Resets the counter to zero.

    Declaration
    public void Reset()
    | Edit this page View Source

    ToString()

    TBD

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    TBD

    Overrides
    object.ToString()

    Implements

    IAtomicCounter<T>

    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