changes
authorPeizhao Ou <peizhaoo@uci.edu>
Wed, 18 Mar 2015 11:12:57 +0000 (04:12 -0700)
committerPeizhao Ou <peizhaoo@uci.edu>
Wed, 18 Mar 2015 11:12:57 +0000 (04:12 -0700)
chase-lev-deque-bugfix/Makefile
chase-lev-deque-bugfix/interesting.txt
chase-lev-deque-bugfix/testcase8.c [new file with mode: 0644]

index 61cc9c144184ff6f35999f060fa1fabaea95cf84..89f8c21c60786649bf343ee9b9138f5cd65d794d 100644 (file)
@@ -2,7 +2,7 @@ include ../benchmarks.mk
 
 BENCH := deque
 
-NORMAL_TESTS := testcase1 testcase2 testcase3 testcase4 testcase5 testcase6 testcase7
+NORMAL_TESTS := testcase1 testcase2 testcase3 testcase4 testcase5 testcase6 testcase7 testcase8
 
 WILDCARD_TESTS := $(patsubst %, %_wildcard, $(NORMAL_TESTS))
 
index 6fbce65bfc96e2f84e581804644cbcb5354be83c..1e221a9c5b2c5e89e624afcbb17145d8f5fbfa89 100644 (file)
@@ -7,7 +7,7 @@ wildcard 5 -> memory_order_relaxed
 wildcard 6 -> memory_order_relaxed
 wildcard 7 -> memory_order_relaxed
 wildcard 8 -> memory_order_seq_cst
-wildcard 9 -> memory_order_relaxed
+wildcard 9 -> memory_order_acquire
 wildcard 10 -> memory_order_relaxed
 wildcard 11 -> memory_order_relaxed
 wildcard 12 -> memory_order_acquire
@@ -36,4 +36,4 @@ wildcard 35 -> memory_order_acquire
 wildcard 36 -> memory_order_acquire
 wildcard 37 -> memory_order_relaxed
 wildcard 38 -> memory_order_relaxed
-wildcard 39 -> memory_order_release
+wildcard 39 -> memory_order_seq_cst
diff --git a/chase-lev-deque-bugfix/testcase8.c b/chase-lev-deque-bugfix/testcase8.c
new file mode 100644 (file)
index 0000000..d954138
--- /dev/null
@@ -0,0 +1,52 @@
+#include <stdlib.h>
+#include <assert.h>
+#include <stdio.h>
+#include <threads.h>
+#include <stdatomic.h>
+
+#include "model-assert.h"
+
+#include "deque.h"
+
+Deque *q;
+int a;
+int b;
+int c;
+
+static void task(void * param) {
+       b=steal(q);
+       //c=steal(q);
+}
+
+int user_main(int argc, char **argv)
+{
+       thrd_t t1, t2;
+       q=create();
+
+       push(q, 1);
+       thrd_create(&t1, task, 0);
+       thrd_create(&t2, task, 0);
+       a=take(q);
+       push(q, 2);
+       c=take(q);
+       push(q, 3);
+       thrd_join(t1);
+       thrd_join(t2);
+
+/*
+       bool correct=true;
+       if (a!=1 && a!=2 && a!=4 && a!= EMPTY)
+               correct=false;
+       if (b!=1 && b!=2 && b!=4 && b!= EMPTY)
+               correct=false;
+       if (c!=1 && c!=2 && c!=4 && a!= EMPTY)
+               correct=false;
+       if (a!=EMPTY && b!=EMPTY && c!=EMPTY && (a+b+c)!=7)
+               correct=false;
+       //if (!correct)
+               printf("a=%d b=%d c=%d\n",a,b,c);
+       MODEL_ASSERT(correct);
+       */
+
+       return 0;
+}