Skip to content

Instantly share code, notes, and snippets.

@dannas
Last active May 3, 2020 20:17
Show Gist options
  • Save dannas/b903ae6d3988bfd6c6280a6a60d8ed34 to your computer and use it in GitHub Desktop.
Save dannas/b903ae6d3988bfd6c6280a6a60d8ed34 to your computer and use it in GitHub Desktop.
// https://godbolt.org/z/pbULFF
#include <atomic>
int read(std::atomic<int>& a) {
return a.load(std::memory_order_seq_cst);
}
void write(std::atomic<int>& a, int value) {
return a.store(value, std::memory_order_seq_cst);
}
void write_rel(std::atomic<int>& a, int value) {
return a.store(value, std::memory_order_release);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment