Search Results for

    Show / Hide Table of Contents

    Class AtomicCounter

    An atomic 32 bit integer counter.

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

    Constructors

    | Edit this page View Source

    AtomicCounter()

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

    Declaration
    public AtomicCounter()
    | Edit this page View Source

    AtomicCounter(int)

    Creates an instance of an AtomicCounter.

    Declaration
    public AtomicCounter(int initialValue)
    Parameters
    Type Name Description
    int initialValue

    The initial value of this counter.

    Properties

    | Edit this page View Source

    Current

    Retrieves the current value of the counter

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

    Methods

    | Edit this page View Source

    AddAndGet(int)

    Adds the specified value to the counter and returns the new value.

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

    The amount to add to the counter.

    Returns
    Type Description
    int

    The new value after additions.

    | Edit this page View Source

    CompareAndSet(int, int)

    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(int expected, int newValue)
    Parameters
    Type Name Description
    int expected

    TBD

    int newValue

    TBD

    Returns
    Type Description
    bool

    TBD

    | Edit this page View Source

    Decrement()

    Decrements the counter and returns the next value

    Declaration
    public int Decrement()
    Returns
    Type Description
    int

    TBD

    | Edit this page View Source

    DecrementAndGet()

    Atomically decrements the counter by one.

    Declaration
    public int DecrementAndGet()
    Returns
    Type Description
    int

    The new value.

    | Edit this page View Source

    GetAndAdd(int)

    Returns the current value and adds the specified value to the counter.

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

    The amount to add to the counter.

    Returns
    Type Description
    int

    The original value before additions.

    | Edit this page View Source

    GetAndDecrement()

    Atomically decrements the counter by one.

    Declaration
    public int GetAndDecrement()
    Returns
    Type Description
    int

    The original value.

    | Edit this page View Source

    GetAndIncrement()

    Atomically increments the counter by one.

    Declaration
    public int GetAndIncrement()
    Returns
    Type Description
    int

    The original value.

    | Edit this page View Source

    GetAndSet(int)

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

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

    TBD

    Returns
    Type Description
    int

    TBD

    | Edit this page View Source

    IncrementAndGet()

    Atomically increments the counter by one.

    Declaration
    public int IncrementAndGet()
    Returns
    Type Description
    int

    The new value.

    | Edit this page View Source

    Next()

    Increments the counter and returns the next value

    Declaration
    public int Next()
    Returns
    Type Description
    int

    TBD

    | Edit this page View Source

    Reset()

    Resets the counter to zero.

    Declaration
    public void Reset()

    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