Quantcast
Channel: Understanding std::atomic::compare_exchange_weak() in C++11 - Stack Overflow
Browsing latest articles
Browse All 6 View Live

Answer by Damir Shaikhutdinov for Understanding...

I think most of the answers above address "spurious failure" as some kind of problem, performance VS correctness tradeoff.It can be seen as the weak version is faster most of the times, but in case of...

View Article



Answer by Eric Z for Understanding std::atomic::compare_exchange_weak() in C++11

I'm trying to answer this myself, after going through various online resources (e.g., this one and this one), the C++11 Standard, as well as the answers given here.The related questions are merged...

View Article

Answer by Sneftel for Understanding std::atomic::compare_exchange_weak() in...

Alright, so I need a function which performs atomic left-shifting. My processor doesn't have a native operation for this, and the standard library doesn't have a function for it, so it looks like I'm...

View Article

Answer by Jonathan Wakely for Understanding...

Why does it have to be in a loop in nearly all uses ?Because if you don't loop and it fails spuriously your program hasn't done anything useful - you didn't update the atomic object and you don't know...

View Article

Answer by gexicide for Understanding std::atomic::compare_exchange_weak() in...

Why doing exchange in a loop?Usually, you want your work to be done before you move on, thus, you put compare_exchange_weak into a loop so that it tries to exchange until it succeeds (i.e., returns...

View Article


Understanding std::atomic::compare_exchange_weak() in C++11

bool compare_exchange_weak (T& expected, T val, ..);compare_exchange_weak() is one of compare-exchange primitives provided in C++11. It's weak in the sense that it returns false even if the value...

View Article
Browsing latest articles
Browse All 6 View Live




Latest Images