changes
[cdsspec-compiler.git] / benchmark / ms-queue / main.c
index f6973a7..6384667 100644 (file)
@@ -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)