Skip to content

Instantly share code, notes, and snippets.

View visualzhou's full-sized avatar

Siyuan Zhou visualzhou

  • MongoDB
  • New York
View GitHub Profile
@RedBeard0531
RedBeard0531 / sc.cpp
Created March 14, 2019 18:45
Example of non-sequential consistency
// {{{
// vim: set foldmethod=marker:
// g++ -O3 -pthread sc.cpp && ./a.out
#include <cstdio>
#include <thread>
#include <atomic>
using namespace std;
constexpr auto load_order = memory_order_acquire;
constexpr auto store_order = memory_order_release;