Quantcast
Channel: Are memory fences required here? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Sam Varshavchik for Are memory fences required here?

$
0
0

30.3.1.2 thread constructors

template <class F, class ...Args> explicit thread(F&& f, Args&&... args);

Synchronization: The completion of the invocation of the constructor synchronizes with the beginning of the invocation of the copy of f.

In other words: when the thread function gets invoked, it is synchronized with everything that happened in the parent thread up until std::thread gets constructed, in the parent thread.

No explicit memory barriers/fences, of this kind, are needed.


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>