X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=spsc-queue%2Fspsc-queue.cc;h=f8528a862acd8f5097ebb3d781e73e8eb7955864;hb=ff4cd01eb602228cbd4091539c3f9754cb946dda;hp=ef7b02635d8f1e525d14191b9ba6b85b33fe7ec2;hpb=6c65f26591800fb20e37ba2a82fb659be07c7d22;p=model-checker-benchmarks.git diff --git a/spsc-queue/spsc-queue.cc b/spsc-queue/spsc-queue.cc index ef7b026..f8528a8 100644 --- a/spsc-queue/spsc-queue.cc +++ b/spsc-queue/spsc-queue.cc @@ -2,27 +2,33 @@ #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); } } -int main() +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; }