Use the old script to measure time
[c11concurrency-benchmarks.git] / cdschecker_modified_benchmarks / chase-lev-deque / main.cc
1 #include <stdlib.h>
2 #include <assert.h>
3 #include <stdio.h>
4 #include "cds_threads.h"
5 //#include <atomic>
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 }
19
20 int user_main(int argc, char **argv)
21 {
22         q=create();
23         std::thread t(task, (void *)0);
24         push(q, 1);
25         push(q, 2);
26         push(q, 4);
27         b=take(q);
28         c=take(q);
29         t.join();
30
31         bool correct=true;
32         if (a!=1 && a!=2 && a!=4 && a!= EMPTY)
33                 correct=false;
34         if (b!=1 && b!=2 && b!=4 && b!= EMPTY)
35                 correct=false;
36         if (c!=1 && c!=2 && c!=4 && a!= EMPTY)
37                 correct=false;
38         if (a!=EMPTY && b!=EMPTY && c!=EMPTY && (a+b+c)!=7)
39                 correct=false;
40         if (!correct)
41                 printf("a=%d b=%d c=%d\n",a,b,c);
42         MODEL_ASSERT(correct);
43
44         return 0;
45 }