我要评分
获取效率
正确性
完整性
易理解

Recommended Memory Barrier

If the logic for multiple threads to access the critical area is unclear, you are advised to use the __ATOMIC_SEQ_CST barrier to avoid consistency problems caused by improper use of the barrier.

A common database scenario is lock operations. A critical area is formed between lock acquire and release to ensure the consistency of the critical area.

  • Lock acquire

    Use the __ATOMIC_ACQUIRE barrier.

  • Lock release

    Use the __ATOMIC_RELEASE barrier.