sofa-pbrpc icon indicating copy to clipboard operation
sofa-pbrpc copied to clipboard

关于volatile变量相关的问题

Open pengwang7 opened this issue 3 years ago • 0 comments

看了代码中有很多volatile修饰的变量,目的是什么,为了statistics更加准确以及为了使用sofa-pbrpc中提供的原子操作吗? 代码中有这样的注释: // And here we need not lock "_pending_lock" because the "_pending_message_count" is // an volatile value. 请教一下volatile与锁有关系吗?

pengwang7 avatar Jul 26 '21 07:07 pengwang7