Mono Class Library: System.Threading.Interlocked Overview | Members

System.Threading.Interlocked.Increment Method

Increments the specified variable and stores the result as an atomic operation. [Edit]

public static long Increment (ref long location)

Parameters

location
A long containing the variable whose value is to be incremented. [Edit]

Returns

A long containing the incremented value. [Edit]

Remarks

This method handles an overflow condition by wrapping: if location = long.MaxValue , location + 1 = long.MinValue . No exception is thrown.

The 64-bit versions of Interlocked.Increment(Int32@) and Interlocked.Decrement(Int32@) are truly atomic only on systems where a IntPtr is 64-bits long. On other systems, these methods are atomic with respect to each other, but not with respect to other means of accessing the data.

[Edit]

Requirements

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0