vendredi 28 avril 2017

nonatomic operations on std::atomic

I have a huge array of pointers and I need to use them atomically. C++11 provides std::atomic class and relative functions for these purposes, and it is quite fine for me in general. But at the initialization and cleanup stages I do not need it to be atomic, it is known that only one thread will operate the data. It would be easy if atomic pointers would be implemented as plain volatile variables like it actually was before C++11, but now here is my problem: std::atomic forces me to use only atomic operations. Is there a way of nonatomic use of std::atomic?

Aucun commentaire:

Enregistrer un commentaire