ee69867f2ebb37d1aa1cd4d9c0bb9f19c0ef2926
[model-checker-benchmarks.git] / chase-lev-deque / 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 "deque.h"
8
9 Deque *q;
10 int a;
11 int b;
12
13 static void task(void * param) {
14         do {
15                 a=steal(q);
16         } while(a==EMPTY);
17 }
18
19 int user_main(int argc, char **argv)
20 {
21         thrd_t t;
22         q=create();
23         thrd_create(&t, task, 0);
24         push(q, 1);
25         push(q, 2);
26         b=take(q);
27         thrd_join(t);
28         if (a+b!=3)
29                 printf("a=%d b=%d\n",a,b);
30         return 0;
31 }