kagali-san
kagali-san

Reputation: 3082

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.

Any chance that a low-level threading implementation used by Boost (pthreads here) would affect the functionality of buitins?

Upvotes: 1

Views: 59

Answers (1)

sehe
sehe

Reputation: 392999

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))

Upvotes: 1

Related Questions