Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道它std::atomic_flag保证是无锁的,而其他原子的东西,例如std::atomic<int>,std::atomic<bool>不是,这意味着它们可能是用锁生成的。
std::atomic_flag
std::atomic<int>
std::atomic<bool>
我的问题是为什么只有一件事std::atomic_flag是无锁的,而其他的可能不是?为什么我们不强制使用无锁来生成类似的东西std::atomic<bool>?有什么技术原因吗?