edits
[cdsspec-compiler.git] / output / spsc-bugfix / spsc-queue.cc
1 #include <threads.h>
2
3 #include "queue.h"
4
5 spsc_queue<int> *q;
6
7         void thread(unsigned thread_index)
8         {
9                 if (0 == thread_index)
10                 {
11                         q->enqueue(11);
12                 }
13                 else
14                 {
15                         int d = q->dequeue();
16                                         }
17         }
18
19 int user_main(int argc, char **argv)
20 {
21         thrd_t A, B;
22
23         q = new spsc_queue<int>();
24
25         thrd_create(&A, (thrd_start_t)&thread, (void *)0);
26         thrd_create(&B, (thrd_start_t)&thread, (void *)1);
27         thrd_join(A);
28         thrd_join(B);
29
30         delete q;
31
32         return 0;
33 }
34