test case exposes model checker bugs :(
-DIRS := barrier mcs-lock mpmc-queue spsc-queue spsc-bugfix linuxrwlocks dekker-fences
+DIRS := barrier mcs-lock mpmc-queue spsc-queue spsc-bugfix linuxrwlocks dekker-fences chase-lev-deque
.PHONY: $(DIRS)
TESTNAME = main
-HEADERS =
-OBJECTS = deque.o
+HEADERS = deque.h
+OBJECTS = main.o deque.o
all: $(TESTNAME)
atomic_store_explicit(&new_a->buffer[i % new_size], atomic_load_explicit(&a->buffer[i % size], memory_order_relaxed), memory_order_relaxed);
}
atomic_store_explicit(&q->array, new_a, memory_order_relaxed);
+ printf("resize\n");
}
void push(Deque *q, int x) {
--- /dev/null
+#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;
+}