[VC]原子操作InterlockedXXX接口中的Acquire和Release区别

例如:InterlockedIncrement接口提供了两个扩展接口,分别是InterlockedIncrementAcquire和InterlockedIncrementRelease。

对于PC上的CPU(比如x86、x64)来说,三者没有区别,效果是等价的,但是对于特定的服务器CPU(比如intel 安腾),带后缀的InterlockedXXX接口速度更快

 

具体见MSDN解释:

https://msdn.microsoft.com/en-us/library/ff540496.aspx

 

其他参考:

What's the difference between InterlockedCompareExchange Release() and Acquire()?

http://stackoverflow.com/questions/9764181/whats-the-difference-between-interlockedcompareexchange-release-and-acquire

 

InterlockedIncrement vs InterlockedIncrementAcquire vs InterlockedIncrementNoFence

http://stackoverflow.com/questions/25487373/interlockedincrement-vs-interlockedincrementacquire-vs-interlockedincrementnofen

 

Acquire and release sound like bass fishing terms, but they also apply to memory models

https://blogs.msdn.microsoft.com/oldnewthing/20081003-00/?p=20663

 

 

猜你喜欢

转载自aigo.iteye.com/blog/2291341
今日推荐