Memory barriers in userspace? (Linux, x86-64)

后端 未结 8 1774
无人及你
无人及你 2021-01-30 18:15

It is easy to set memory barriers on the kernel side: the macros mb, wmb, rmb, etc. are always in place thanks to the Linux kernel headers.

How to accomplish this on th

8条回答
  •  深忆病人
    2021-01-30 19:00

    You are looking for the full memory barrier atomic builtins of gcc.

    Please note the detail on the reference i gave here says,

    The [following] builtins are intended to be compatible with those described in the Intel Itanium Processor-specific Application Binary Interface, section 7.4. As such, they depart from the normal GCC practice of using the “__builtin_” prefix, and further that they are overloaded such that they work on multiple types.

提交回复
热议问题