e621af9d2b31178583a244cd47faa89e64085475
[model-checker-benchmarks.git] / chase-lev-deque-bugfix / testcase6.c
1 #include <stdlib.h>
2 #include <assert.h>
3 #include <stdio.h>
4 #include <threads.h>
5 #include <stdatomic.h>
6
7 #include "model-assert.h"
8
9 #include "deque.h"
10
11 Deque *q;
12 int a;
13 int b;
14 int c;
15
16 /** Making w15 release */
17
18 static void task1(void * param) {
19         b=steal(q);
20         //c=steal(q);
21 }
22
23 static void task2(void * param) {
24         b=steal(q);
25         //c=steal(q);
26 }
27
28 int user_main(int argc, char **argv)
29 {
30         thrd_t t1, t2;
31         q=create();
32
33         push(q, 1);
34         thrd_create(&t1, task1, 0);
35         thrd_create(&t2, task2, 0);
36         a=take(q);
37         push(q, 2);
38         c=take(q);
39         //push(q, 2);
40         //push(q, 3);
41         thrd_join(t1);
42         thrd_join(t2);
43
44 /*
45         bool correct=true;
46         if (a!=1 && a!=2 && a!=4 && a!= EMPTY)
47                 correct=false;
48         if (b!=1 && b!=2 && b!=4 && b!= EMPTY)
49                 correct=false;
50         if (c!=1 && c!=2 && c!=4 && a!= EMPTY)
51                 correct=false;
52         if (a!=EMPTY && b!=EMPTY && c!=EMPTY && (a+b+c)!=7)
53                 correct=false;
54         //if (!correct)
55                 printf("a=%d b=%d c=%d\n",a,b,c);
56         MODEL_ASSERT(correct);
57         */
58
59         return 0;
60 }