X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=spsc-queue%2Fspsc-queue.cc;h=f8528a862acd8f5097ebb3d781e73e8eb7955864;hb=refs%2Ftags%2Foopsla2013;hp=a81a1d0ce357e66c4f0b86bec5f6e6ca98b5ec66;hpb=ced31653a84f29c3f236fb5976f1241262953914;p=model-checker-benchmarks.git diff --git a/spsc-queue/spsc-queue.cc b/spsc-queue/spsc-queue.cc index a81a1d0..f8528a8 100644 --- a/spsc-queue/spsc-queue.cc +++ b/spsc-queue/spsc-queue.cc @@ -1,24 +1,34 @@ +#include + #include "queue.h" -struct spsc_queue_test : rl::test_suite -{ - 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) { - rl::simulate(); + 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; }