Quantcast
Channel: Is there a function to load a non-atomic value atomically? - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by Peter Cordes for Is there a function to load a non-atomic value...

Non-portably of course, there is GNU C __atomic_load_n(&x, __ATOMIC_SEQ_CST)__atomic builtin.I'm pretty sure you don't find a function in ISO C++ that takes a double * or double &.Possibly one...

View Article



Is there a function to load a non-atomic value atomically?

In C++20 we can write:double x;double x_value = std::atomic_ref(x).load();Is there a function with the same effect?I have tried std::atomic_load but there seem to be no overloads for non-atomic objects.

View Article
Browsing all 2 articles
Browse latest View live




Latest Images