786aa3c9e975a6b013886887b3d375a98ba68560
[cdsspec-compiler.git] / benchmark / chase-lev-deque-bugfix / main.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 task(void * param) {
17         //a=steal(q);
18         a=steal(q);
19 }
20
21 int user_main(int argc, char **argv)
22 {
23         /**
24                 @Begin
25                 @Entry_point
26                 @End
27         */
28         thrd_t t;
29         q=create();
30         thrd_create(&t, task, 0);
31         push(q, 1);
32         push(q, 2);
33         push(q, 4);
34         b=take(q);
35         c=take(q);
36         thrd_join(t);
37 /*
38         bool correct=true;
39         if (a!=1 && a!=2 && a!=4 && a!= EMPTY)
40                 correct=false;
41         if (b!=1 && b!=2 && b!=4 && b!= EMPTY)
42                 correct=false;
43         if (c!=1 && c!=2 && c!=4 && a!= EMPTY)
44                 correct=false;
45         if (a!=EMPTY && b!=EMPTY && c!=EMPTY && (a+b+c)!=7)
46                 correct=false;
47         if (!correct)
48                 printf("a=%d b=%d c=%d\n",a,b,c);
49                 */
50         //MODEL_ASSERT(correct);
51
52         return 0;
53 }