ef7b02635d8f1e525d14191b9ba6b85b33fe7ec2
[model-checker-benchmarks.git] / spsc-queue / 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                         RL_ASSERT(11 == d);
17                 }
18         }
19
20 int main()
21 {
22         thrd_t A, B;
23         thrd_create(&A, (thrd_start_t)&thread, (void *)0);
24         thrd_create(&B, (thrd_start_t)&thread, (void *)1);
25         thrd_join(A);
26         thrd_join(B);
27         return 0;
28 }