273bae35b7fad29f1c0c194dee930f6d7dc0335d
[model-checker-benchmarks.git] / chase-lev-deque-bugfix / testcase9.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 static void task1(void * param) {
17         b=steal(q);
18         //c=steal(q);
19 }
20
21 static void task2(void * param) {
22         b=steal(q);
23         //c=steal(q);
24 }
25
26 int user_main(int argc, char **argv)
27 {
28         thrd_t t1, t2;
29         q=create();
30
31         push(q, 1);
32         thrd_create(&t1, task1, 0);
33         thrd_create(&t2, task2, 0);
34         a=take(q);
35         push(q, 2);
36         c=take(q);
37         //push(q, 2);
38         //push(q, 3);
39         thrd_join(t1);
40         thrd_join(t2);
41
42 /*
43         bool correct=true;
44         if (a!=1 && a!=2 && a!=4 && a!= EMPTY)
45                 correct=false;
46         if (b!=1 && b!=2 && b!=4 && b!= EMPTY)
47                 correct=false;
48         if (c!=1 && c!=2 && c!=4 && a!= EMPTY)
49                 correct=false;
50         if (a!=EMPTY && b!=EMPTY && c!=EMPTY && (a+b+c)!=7)
51                 correct=false;
52         //if (!correct)
53                 printf("a=%d b=%d c=%d\n",a,b,c);
54         MODEL_ASSERT(correct);
55         */
56
57         return 0;
58 }