yuinm opened a new issue #720: 关于volatile关键字
URL: https://github.com/apache/incubator-brpc/issues/720
 
 
   关于volatile能否给科普一下,查资料怎么说的都有,代码里有好多地方用到volatile看起来很晕。
   只是知道volatile能避免编译器优化。
   https://www.zhihu.com/topic/20034193/top-answers 这个说法是否正确(KE meng 这个人的回答)。
   
   这个宏我理解成强制某个变量是volatile的。
   #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
   
   @jamesge 
   希望可以了解到什么时候应该用volatile 
   非常感激。

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to