c++, std::atomic, what is std::memory_order and how to use them?

后端 未结 5 1837
小鲜肉
小鲜肉 2020-12-04 06:46

Can anyone explain what is std::memory_order in plain English, and how to use them with std::atomic<>?

I found the reference and few

5条回答
  •  广开言路
    2020-12-04 07:18

    No. A "plain english" explanation takes 32 pages and can be found here.

    If you don't want to read that, you can forget about memory ordering because the page you linked to says that the default is sequentially-consistent ordering, which is "always do the sane thing"-setting.

    To use any other setting you really have to read and understand the above paper and the examples in it.

提交回复
热议问题