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

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原有的值

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值