X-Git-Url: http://plrg.eecs.uci.edu/git/?p=cdsspec-compiler.git;a=blobdiff_plain;f=benchmark%2Fms-queue%2Fmain.c;h=63846670512c3f5e9ff64b36a4ca54d00a712011;hp=f6973a706ced450952d2e7180579ddb0d9c4acc9;hb=eeea572e974cb93f35d6788250d011a031ffba2f;hpb=9e08fb16f226a6c13a3526150a41814746805631 diff --git a/benchmark/ms-queue/main.c b/benchmark/ms-queue/main.c index f6973a7..6384667 100644 --- a/benchmark/ms-queue/main.c +++ b/benchmark/ms-queue/main.c @@ -5,7 +5,7 @@ #include "my_queue.h" #include "model-assert.h" -static int procs = 3; +static int procs = 2; static queue_t *queue; static thrd_t *threads; static unsigned int *input; @@ -39,39 +39,28 @@ static void main_task(void *param) enqueue(queue, input[1]); } */ - - if (pid % 3 == 0) { + if (pid % 2 == 0) { input[0] = 17; enqueue(queue, input[0]); - printf("Enqueue %d.\n", 17); + printf("Thrd %d Enqueue %d.\n", get_thread_num(), input[0]); - succ1 = dequeue(queue, &input[0]); + succ1 = dequeue(queue, &output[0]); if (succ1) - printf("Thrd 2: Dequeue %d.\n", input[0]); + printf("Thrd %d: Dequeue %d.\n", get_thread_num(), output[0]); else - printf("Thrd 2: Dequeue NULL.\n"); - - } else if (pid % 3 == 1) { + printf("Thrd %d: Dequeue NULL.\n", get_thread_num()); + } else if (pid % 2 == 1) { input[1] = 37; enqueue(queue, input[1]); - printf("Enqueue %d.\n", 37); + printf("Thrd %d Enqueue %d.\n", get_thread_num(), input[1]); - succ1 = dequeue(queue, &input[0]); - if (succ1) - printf("Thrd 3: Dequeue %d.\n", input[0]); - else - printf("Thrd 3: Dequeue NULL.\n"); - } else if (pid %3 == 2) { - /* succ2 = dequeue(queue, &output[1]); if (succ2) - printf("Dequeue %d.\n", input[1]); + printf("Thrd %d: Dequeue %d.\n", get_thread_num(), output[1]); else - printf("Dequeue NULL.\n"); - */ + printf("Thrd %d: Dequeue NULL.\n", get_thread_num()); } - } int user_main(int argc, char **argv)