Class InterlockedCounter
Implementation of AtomicCounter based on .NET System.Threading.Interlocked class.
Inherited Members
Namespace: Tangosol.Util
Assembly: Coherence.dll
Syntax
public class InterlockedCounter : AtomicCounter
Fields
m_counter
The actual counter value.
Declaration
protected long m_counter
Field Value
Type | Description |
---|---|
long |
Methods
Adjust(long)
Adjust the value of the counter by the specified amount, and return the new value.
Declaration
protected override long Adjust(long c)
Parameters
Type | Name | Description |
---|---|---|
long | c | The amount to adjust the counter by. |
Returns
Type | Description |
---|---|
long | The new value, after the adjustment has been made. |
Overrides
GetCount()
Return the current value of the counter.
Declaration
public override long GetCount()
Returns
Type | Description |
---|---|
long | The current value. |
Overrides
PostAdjust(long)
Adjust the value of the counter by the specified amount, and return the old value.
Declaration
protected override long PostAdjust(long c)
Parameters
Type | Name | Description |
---|---|---|
long | c | The amount to adjust the counter by. |
Returns
Type | Description |
---|---|
long | The old value, prior to the adjustment having been made. |
Overrides
SetCount(long)
Update the current value, and return the previous value.
Declaration
public override long SetCount(long newValue)
Parameters
Type | Name | Description |
---|---|---|
long | newValue | The new value. |
Returns
Type | Description |
---|---|
long | The previous value just before the update went through. |
Overrides
SetCount(long, long)
Update the current value, only if it is equal to the assumed value.
Declaration
public override bool SetCount(long assumedValue, long newValue)
Parameters
Type | Name | Description |
---|---|---|
long | assumedValue | The assumed old value. |
long | newValue | The new value. |
Returns
Type | Description |
---|---|
bool | true if the value was updated, false otherwise. |