X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker-benchmarks.git;a=blobdiff_plain;f=spsc-queue%2Fspsc-queue.cc;h=f8528a862acd8f5097ebb3d781e73e8eb7955864;hp=b689936ae6918411da1c3192e28137ce122ca911;hb=HEAD;hpb=ae1e51950d28aad23f47611cd9afb33718b4beec diff --git a/spsc-queue/spsc-queue.cc b/spsc-queue/spsc-queue.cc index b689936..f8528a8 100644 --- a/spsc-queue/spsc-queue.cc +++ b/spsc-queue/spsc-queue.cc @@ -2,17 +2,17 @@ #include "queue.h" -spsc_queue q; +spsc_queue *q; void thread(unsigned thread_index) { if (0 == thread_index) { - q.enqueue(11); + q->enqueue(11); } else { - int d = q.dequeue(); + int d = q->dequeue(); RL_ASSERT(11 == d); } } @@ -20,9 +20,15 @@ spsc_queue q; int user_main(int argc, char **argv) { thrd_t A, B; + + q = new spsc_queue(); + thrd_create(&A, (thrd_start_t)&thread, (void *)0); thrd_create(&B, (thrd_start_t)&thread, (void *)1); thrd_join(A); thrd_join(B); + + delete q; + return 0; }