From: Brian Norris Date: Sat, 9 Mar 2013 01:25:24 +0000 (-0800) Subject: litmus: wrc: add macro for memory ordering X-Git-Tag: oopsla2013~145 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker.git;a=commitdiff_plain;h=558639859f57b469b0b0c1a16690262a277c9f30 litmus: wrc: add macro for memory ordering For manual inspection of these tests, one might want to change the memory-ordering for the loads/stores. Note that this changes the default to use relaxed. --- diff --git a/test/litmus/wrc.cc b/test/litmus/wrc.cc index 225eb4b..7d295fe 100644 --- a/test/litmus/wrc.cc +++ b/test/litmus/wrc.cc @@ -5,19 +5,23 @@ static int N = 2; -std::atomic_int *x; +/* Can be tested for different behavior with relaxed vs. release/acquire/seq-cst */ +#define load_mo std::memory_order_relaxed +#define store_mo std::memory_order_relaxed + +static std::atomic_int *x; static void a(void *obj) { int idx = *((int *)obj); if (idx > 0) - x[idx - 1].load(std::memory_order_relaxed); + x[idx - 1].load(load_mo); if (idx < N) - x[idx].store(1, std::memory_order_relaxed); + x[idx].store(1, store_mo); else - x[0].load(std::memory_order_relaxed); + x[0].load(load_mo); } int user_main(int argc, char **argv)