c++ - 用户空间中的内存障碍? (Linux,x86-64)

标签 c++ c multithreading lock-free memory-barriers

在内核端设置内存屏障很容易:由于 Linux 内核头文件,宏 mb、wmb、rmb 等始终存在。

如何在用户端做到这一点?

最佳答案

您正在寻找 full memory barrier gcc 的原子内置函数。

请注意我在这里给出的引用资料的详细信息,

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.

关于c++ - 用户空间中的内存障碍? (Linux,x86-64),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1185063/

相关文章:

c++ - 在 std::thread 创建的线程中调用 pthread_sigmask 是一种好习惯吗?

c++ - 如何在 Ubuntu 中使 TensorFlow-lite 可用于整个系统

c - 这个将 char 数组转换为 int 数组的函数不起作用吗?

c++ - 被调用方返回对象的范围 w.r.t.调用者局部变量?

c - 获取数组的两个地址的差异(使用 & 运算符)

c - 我在这里遇到运行时错误的具体原因是什么?

android - 在android中,为什么UI不能脱离UI线程更新?

c# - SaveFileDialog:由于多线程应用程序中的 "owner"参数导致 InvalidOperationException

multithreading - 超线程/SMT 是一个有缺陷的概念吗?

c++ - 在 C++ 程序中合并两个数组