Skip to content

Instantly share code, notes, and snippets.

@jeremy-rifkin
Created July 1, 2021 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremy-rifkin/6bb5f9993963ff40e78acb8c3d23a99c to your computer and use it in GitHub Desktop.
Save jeremy-rifkin/6bb5f9993963ff40e78acb8c3d23a99c to your computer and use it in GitHub Desktop.
This can only end well
#include <atomic>
#include <stdlib.h>
constexpr std::memory_order orders[] = {
std::memory_order_relaxed,
std::memory_order_consume,
std::memory_order_acquire,
std::memory_order_release,
std::memory_order_acq_rel,
std::memory_order_seq_cst
};
std::memory_order memory_order_roulette() {
return orders[rand() % std::size(orders)];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment