Android Guides | Samples

Java.Util.Concurrent.Atomic.AtomicLong Class

A long value that may be updated atomically.

See Also: AtomicLong

Syntax

[Android.Runtime.Register("java/util/concurrent/atomic/AtomicLong", DoNotGenerateAcw=true)]
public class AtomicLong : Number, IDisposable

Remarks

A long value that may be updated atomically. See the Java.Util.Concurrent.Atomic package specification for description of the properties of atomic variables. An AtomicLong is used in applications such as atomically incremented sequence numbers, and cannot be used as a replacement for a Long. However, this class does extend Number to allow uniform access by tools and utilities that deal with numerically-based classes.

[Android Documentation]

Requirements

Namespace: Java.Util.Concurrent.Atomic
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Java.Util.Concurrent.Atomic.AtomicLong are listed below.

See Also: Number

Public Constructors

Creates a new AtomicLong with initial value 0.
Creates a new AtomicLong with the given initial value.

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

[read-only]
AndDecrementInt64. Atomically decrements by one the current value.
[read-only]
AndIncrementInt64. Atomically increments by one the current value.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

AddAndGet(Int64) : Int64
Atomically adds the given value to the current value.
CompareAndSet(Int64, Int64) : Boolean
Atomically sets the value to the given updated value if the current value == the expected value.
DecrementAndGet() : Int64
Atomically decrements by one the current value.
override
DoubleValue() : Double
Returns the value of this AtomicLong as a double after a widening primitive conversion.
override
FloatValue() : Single
Returns the value of this AtomicLong as a float after a widening primitive conversion.
Get() : Int64
Gets the current value.
GetAndAdd(Int64) : Int64
Atomically adds the given value to the current value.
GetAndSet(Int64) : Int64
Atomically sets to the given value and returns the old value.
IncrementAndGet() : Int64
Atomically increments by one the current value.
override
IntValue() : Int32
Returns the value of this AtomicLong as an int after a narrowing primitive conversion.
LazySet(Int64)
Eventually sets to the given value.
override
LongValue() : Int64
Returns the value of this AtomicLong as a long.
Set(Int64)
Sets to the given value.
WeakCompareAndSet(Int64, Int64) : Boolean
Atomically sets the value to the given updated value if the current value == the expected value.