Search Results for

    Show / Hide Table of Contents

    Class AtomicLong

    A long that can be operatered on atomically.

    Inheritance
    System.Object
    AtomicLong
    Namespace: FM.LiveSwitch
    Assembly: FM.LiveSwitch.dll
    Syntax
    public class AtomicLong : object

    Constructors

    AtomicLong()

    Create a new AtomicLong with a initial value of 0.

    Declaration
    public AtomicLong()

    AtomicLong(Int64)

    Create a new AtomicLong with an initial value.

    Declaration
    public AtomicLong(long initialValue)
    Parameters
    Type Name Description
    System.Int64 initialValue

    Properties

    Value

    The current value.

    Declaration
    public long Value { get; }
    Property Value
    Type Description
    System.Int64

    Methods

    Add(Int64)

    Atomically add a integer to the value.

    Declaration
    public long Add(long delta)
    Parameters
    Type Name Description
    System.Int64 delta

    The amount to add.

    Returns
    Type Description
    System.Int64

    CompareAndSwap(Int64, Int64)

    Compares two 64-bit signed integers for equality and, if they are equal, replaces one of the values.

    Declaration
    public long CompareAndSwap(long expected, long newValue)
    Parameters
    Type Name Description
    System.Int64 expected

    The value to compare.

    System.Int64 newValue

    The value used to replace.

    Returns
    Type Description
    System.Int64

    The original value.

    Decrement()

    Atomically decrement the value by 1.

    Declaration
    public long Decrement()
    Returns
    Type Description
    System.Int64

    The value decremented by one.

    Increment()

    Atomically increment the value by 1.

    Declaration
    public long Increment()
    Returns
    Type Description
    System.Int64

    The value incremented by 1.

    Subtract(Int64)

    Atomically subtract a integer to the value.

    Declaration
    public long Subtract(long delta)
    Parameters
    Type Name Description
    System.Int64 delta

    The amount to subtract.

    Returns
    Type Description
    System.Int64
    In This Article
    Back to top Copyright © LiveSwitch Inc. All Rights Reserved. Doc build for LiveSwitch v1.15.0