An int value that may be updated atomically. An AtomicInteger is used in applications such as atomically incremented counters, and cannot be used as a replacement for an int.
More...
|
int | Value [get, set] |
| Gets and sets the current value. More...
|
|
T | Value [get, set] |
| Gets and sets the current value. More...
|
|
An int value that may be updated atomically. An AtomicInteger is used in applications such as atomically incremented counters, and cannot be used as a replacement for an int.
Based on the on the back port of JCP JSR-166.
- Author
- Doug Lea
-
Griffin Caprio (.NET)
-
Andreas Doehring (.NET)
-
Kenneth Xu (Interlocked)
Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.AtomicInteger |
( |
int |
initialValue | ) |
|
Creates a new AtomicInteger with a value of initialValue .
- Parameters
-
initialValue | The initial value |
Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.AtomicInteger |
( |
| ) |
|
int Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.AddDeltaAndReturnNewValue |
( |
int |
deltaValue | ) |
|
Atomically adds deltaValue to the current value.
- Parameters
-
deltaValue | The value to add |
- Returns
- The updated value
int Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.AddDeltaAndReturnPreviousValue |
( |
int |
deltaValue | ) |
|
Atomically adds deltaValue to the current value.
- Parameters
-
deltaValue | The value to add |
- Returns
- The previous value
bool Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.CompareAndSet |
( |
int |
expectedValue, |
|
|
int |
newValue |
|
) |
| |
Atomically sets the value to newValue if the current value == expectedValue
- Parameters
-
expectedValue | The expected value |
newValue | The new value |
- Returns
true
if successful. false
return indicates that the actual value was not equal to the expected value.
int Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.DecrementValueAndReturn |
( |
| ) |
|
Atomically decrements by one the current value.
- Returns
- The updated value
int Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.Exchange |
( |
int |
newValue | ) |
|
Atomically sets value to newValue and returns the old value.
- Parameters
-
- Returns
- The previous value
int Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.IncrementValueAndReturn |
( |
| ) |
|
Atomically increments the current value by one.
- Returns
- The updated value
void Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.LazySet |
( |
int |
newValue | ) |
|
Eventually sets to the given value.
- Parameters
-
static implicit Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.operator int |
( |
AtomicInteger |
atomicInteger | ) |
|
|
static |
Implicit converts AtomicInteger to int.
- Parameters
-
- Returns
- The converted int value of atomicInteger .
int Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.ReturnValueAndDecrement |
( |
| ) |
|
Atomically decrements by one the current value.
- Returns
- The previous value
int Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.ReturnValueAndIncrement |
( |
| ) |
|
Atomically increments by one the current value.
- Returns
- The previous value
override string Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.ToString |
( |
| ) |
|
Returns the String representation of the current value.
- Returns
- The String representation of the current value.
virtual bool Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.WeakCompareAndSet |
( |
int |
expectedValue, |
|
|
int |
newValue |
|
) |
| |
|
virtual |
Atomically sets the value to newValue if the current value == expectedValue
- Parameters
-
expectedValue | The expected value |
newValue | The new value |
- Returns
true
if successful. false
return indicates that the actual value was not equal to the expected value.
int Summer.Batch.Common.Util.AtomicTypes.AtomicInteger.Value |
|
getset |
Gets and sets the current value.
- Returns
- The current value
The documentation for this class was generated from the following file:
- Summer.Batch.Common/Util/AtomicTypes/AtomicInteger.cs