不鸣则已

海阔凭鱼跃,天高任鸟飞!

首页 新随笔 联系 订阅 管理

T location1 = v1;

T value = v2;

T res = Interlocked.CompareExchange(ref location1, value, conparand)

=

 

if(location1 == conparand){
  res = location1;

  location1 = value;

}

else{
  res = location1;

}

posted on 2015-05-20 18:24  唐群  阅读(648)  评论(0编辑  收藏  举报