C++ Memory Barriers for Atomics

前端 未结 2 856
深忆病人
深忆病人 2020-12-04 22:30

I\'m a newbie when it comes to this. Could anyone provide a simplified explanation of the differences between the following memory barriers?

  • The windows
2条回答
  •  天命终不由人
    2020-12-04 23:03

    See my answer here on the hardware level semantics of fences. What is not mentioned there is that they also prevent reordering of loads, stores or loads & stores(depending on the fence) across fences, at both compiler level and hardware level.

提交回复
热议问题