Bla*_*iwi 6 c++ windows icc visual-studio c++11
是否有可能哄骗std :: atomic输出CMPXCHG16B用于我对在Windows x64上使用原子互锁操作不感兴趣的类型,或者我只需要吸收它并手动执行原子操作?我可以让GCC/Clang在Linux上这样做,所以我怀疑它只是微软标准库的一个问题.
struct Byte16
{
int64_t a, b;
};
std::atomic<Byte16> atm;
Byte16 a = { 1, 2 };
atm.compare_exchange_strong(...); // This has a lock on Windows, not on Linux version of code
Run Code Online (Sandbox Code Playgroud)
DU *_*aen -2
在 Windows 中使用 __m128
#include <emmintrin.h>
//...
std::atomic<__m128> a, c;
__m128 b;
a.compare_exchange_strong(b,c);
///...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
467 次 |
| 最近记录: |