deque: add test driver, add print messages for now for resize method and if we pull...
[model-checker-benchmarks.git] / chase-lev-deque / main.c
diff --git a/chase-lev-deque/main.c b/chase-lev-deque/main.c
new file mode 100644 (file)
index 0000000..64d0444
--- /dev/null
@@ -0,0 +1,29 @@
+#include <stdlib.h>
+#include <assert.h>
+#include <stdio.h>
+#include <threads.h>
+#include <stdatomic.h>
+
+#include "deque.h"
+
+Deque *q;
+int a;
+int b;
+
+static void task(void * param) {
+       a=steal(q);
+}
+
+int user_main(int argc, char **argv)
+{
+       thrd_t t;
+       q=create();
+       thrd_create(&t, task, 0);
+       push(q, 1);
+       push(q, 2);
+       b=take(q);
+       thrd_join(t);
+       if (a+b!=3)
+               printf("a=%d b=%d\n",a,b);
+       return 0;
+}