简体   繁体   English

gcc原子内置函数:多线程环境中是否存在任何已知冲突?

[英]gcc atomic built-in functions: any known conflicts within multithreading environments?

So, I want to avoid future problems when using __sync_fetch_and_add in a context of Boost-based multithreaded application. 因此,在基于Boost的多线程应用程序的上下文中使用__sync_fetch_and_add时,我想避免将来出现问题。

Any chance that a low-level threading implementation used by Boost (pthreads here) would affect the functionality of buitins? Boost使用的低级线程实现(此处为pthreads)是否有可能影响buitins的功能?

The builtins are the intrinsics. 内建函数是内在函数。

They don't make assumptions about the libraries that will be used in applications. 他们不对将在应用程序中使用的库进行假设。

There is no way it can interfere. 它不可能干预。


(On a tangent: Some libraries, like Boost Asio, optionally can use C++11 atomics instead of boost::detail::atomic_count (doc) ) (切线:一些库,例如Boost Asio,可以选择使用C ++ 11原子而不是boost::detail::atomic_count (doc)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM