标签:
https://msdn.microsoft.com/en-us/library/k9hz8w9t(v=vs.110).aspx
Compares two single-precision floating point numbers for equality and, if they are equal, replaces the first value.
/// <summary> /// 比较location1和comparand的值,如果它们的值相等,就用value的值替换location1的值 /// </summary> /// <param name="location1">The destination, whose value is compared with comparand and possibly replaced.</param> /// <param name="value">The value that replaces the destination value if the comparison results in equality.</param> /// <param name="comparand">The value that is compared to the value at location1.</param> /// <returns>The original value in location1.</returns> public static float CompareExchange(ref float location1, float value, float comparand)
Remarks
If comparand and the value in location1 are equal, then value is stored in location1.
Otherwise, no operation is performed.
The compare and exchange operations are performed as an atomic operation.
The return value of CompareExchange is the original value in location1, whether or not the exchange takes place.//不管exchange是否发生,返回值,都是location1原有的值
public static float CompareExchange(ref float location1,float value,float comparand)
标签:
原文地址:http://www.cnblogs.com/chucklu/p/5442774.html