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

System.Threading.Interlocked.CompareExchange Method

Compares two float values for equality and stores a specified value if they are equal.

public static float CompareExchange (ref float location1, float value, float comparand)

Parameters

location1
A float whose value is updated with value if its original value is equal to comparand.
value
The float value that will replace value of location1 if location1 and comparand are equal.
comparand
A float to be compared to location1.

Returns

A float containing the original value of location1.

Exceptions

TypeReason
ArgumentNullExceptionThe address of location1 is null .

Remarks

The compare and store operations are performed as an atomic operation.

Requirements

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