vendredi 25 septembre 2015

Is it safe to use memory_order_relaxed to load an atomic variable, when in the only thread that writes to that variable?

I have a thread that writes to an atomic variable. (using memory_order_release). Thread A

There are many other threads that read from that variable. (using memory_order_acquire). Thread B.

Is it safe, when in thread A, to read that variable with memory_order_relaxed ?

Aucun commentaire:

Enregistrer un commentaire