How to perform atomic operations on Linux that work on x86, arm, GCC and icc?

前端 未结 9 1577
無奈伤痛
無奈伤痛 2020-12-02 11:52

Every Modern OS provides today some atomic operations:

  • Windows has Interlocked* API
  • FreeBSD has
9条回答
  •  甜味超标
    2020-12-02 12:54

    Recent standards (from 2011) of C & C++ now specify atomic operations:

    • C11: stdatomic.h
    • C++11: std::atomic

    Regardless, your platform or compiler may not support these newer headers & features.

提交回复
热议问题