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

淺唱寂寞╮ 提交于 2019-11-29 07:13:31

The plain version uses a full barrier while the suffixed versions only deals with loads or stores, this can be faster on some CPUs (Itanium-based processors etc)

MSDN has a article about Acquire and Release Semantics and the Interlocked* API as well as this great blog post. The Linux memory barrier documentation might also be useful...

I found this and this on MSDN:

Acquire memory semantics specify that the memory operation being performed by the current thread will be visible before any other memory operations are attempted. Release memory semantics specify that the memory operation being performed by the current thread will be visible after all other memory operations have been completed. These semantics allow you to force memory operations to be performed in a specific order. Use acquire semantics when entering a protected region and release semantics when leaving it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!