Skip to content

Full memory barrier/fence

Release-acquire and full memory barrier

在下面文章中讨论了这个问题:

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

A

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)

NOTE: level

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...

NOTE: 上述 this great blog post ,所链接的是下面的: microsoft Acquire and release sound like bass fishing terms, but they also apply to memory models.

2、stackoverflow How to understand acquire and release semantics?

A

Acquire says "only worry about stuff after me". Release says "only worry about stuff before me". Combining those both is a full memory barrier.