Browsing index pages (3 articles)
↧
Are there any implicit memory barriers in C++
In the following code, is using atomics necessary to guarantee race-free semantics on all platforms or does the use the use of a promise.set_value/future.wait imply some kind of implicit memory barrier...
View ArticleAnswer by Oliort UA for Are there any implicit memory barriers in C++
thread.join() and promise.set_value()/future.wait() guarantee to imply memory barriers.Using atomic_bool is necessary if you don't want the compiler to reorder boolean check or assignment with other...
View ArticleAnswer by darune for Are there any implicit memory barriers in C++
std::atomic_bool flag{false}; // <- does this need to be atomic?Yes.The call:prom.get_future()returns a std::future<void> object.For the future, the reference says the following:The class...
View Article
Browsing index pages (3 articles)