projects
/
model-checker.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
README.md: move copyright down
[model-checker.git]
/
test
/
litmus
/
iriw.cc
diff --git
a/test/litmus/iriw.cc
b/test/litmus/iriw.cc
index 80ee8b90f77ecd2ba3aa5f8e41b48b5f9017343f..fa4a0341049a2a07f66c72c040db8ed54e3cd39f 100644
(file)
--- a/
test/litmus/iriw.cc
+++ b/
test/litmus/iriw.cc
@@
-5,32
+5,39
@@
std::atomic_int x;
std::atomic_int y;
std::atomic_int x;
std::atomic_int y;
+std::memory_order store_mo = std::memory_order_release;
+std::memory_order load_mo = std::memory_order_acquire;
+
static void a(void *obj)
{
static void a(void *obj)
{
- x.store(1, st
d::memory_order_release
);
+ x.store(1, st
ore_mo
);
}
static void b(void *obj)
{
}
static void b(void *obj)
{
- y.store(1, st
d::memory_order_release
);
+ y.store(1, st
ore_mo
);
}
static void c(void *obj)
{
}
static void c(void *obj)
{
- printf("x1: %d\n", x.load(
std::memory_order_acquire
));
- printf("y1: %d\n", y.load(
std::memory_order_acquire
));
+ printf("x1: %d\n", x.load(
load_mo
));
+ printf("y1: %d\n", y.load(
load_mo
));
}
static void d(void *obj)
{
}
static void d(void *obj)
{
- printf("y2: %d\n", y.load(
std::memory_order_acquire
));
- printf("x2: %d\n", x.load(
std::memory_order_acquire
));
+ printf("y2: %d\n", y.load(
load_mo
));
+ printf("x2: %d\n", x.load(
load_mo
));
}
int user_main(int argc, char **argv)
{
thrd_t t1, t2, t3, t4;
}
int user_main(int argc, char **argv)
{
thrd_t t1, t2, t3, t4;
+ /* Command-line argument 's' enables seq_cst test */
+ if (argc > 1 && *argv[1] == 's')
+ store_mo = load_mo = std::memory_order_seq_cst;
+
atomic_init(&x, 0);
atomic_init(&y, 0);
atomic_init(&x, 0);
atomic_init(&y, 0);