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.
+/* 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)
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);
- x[idx].store(1, std::memory_order_relaxed);
+ x[idx].store(1, store_mo);
- x[0].load(std::memory_order_relaxed);
}
int user_main(int argc, char **argv)
}
int user_main(int argc, char **argv)