gpt4 book ai didi

c++ - std::_Atomic_thread_fence(大写字母 A)是否正确?

转载 作者:行者123 更新时间:2023-11-28 06:17:09 28 4
gpt4 key购买 nike

Visual Studio 2012 c++ 文档指出 _ReadBarrier_WriteBarrier内在函数现在是 deprecated:

The _ReadBarrier, _WriteBarrier, and _ReadWriteBarrier compiler intrinsics and the MemoryBarrier macro are all deprecated and should not be used. For inter-thread communication, use mechanisms such as atomic_thread_fence and std::atomic<T> that are defined in the C++ Standard Library Reference. For hardware access, use the /volatile:iso compiler option together with the volatile (C++) keyword.

按照指示,我然后跳转到 atomic_thread_fence documentation它指出该函数是在标题 <atomic> 上定义的.如果我在我的解决方案中包含这样的标题,我找不到该函数,但我确实找到了 std::_Atomic_thread_fence相反。

命名表明这是 Microsoft 特定的实现。这是文档问题还是我应该修改默认值 #include搜索路径?

最佳答案

这似乎只是 Visual Studio 智能感知的问题。如果您将其更正为 atomic_thread_fence,它应该会按预期工作。

关于c++ - std::_Atomic_thread_fence(大写字母 A)是否正确?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30039173/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com