X-Git-Url: https://git.ti.com/gitweb?p=ipc%2Fipcdev.git;a=blobdiff_plain;f=linux%2Fsrc%2Ftests%2FMessageQMulti.c;h=a2c41d465cf620061dee34001b2474de073ade63;hp=475b3cf63d3b0a17a3d39f24828102e306b5a187;hb=323c802df0d12d887ffa92bc65299ce374a3a672;hpb=54fa164e681c60a356a108118f22fea32773ccb7;ds=inline diff --git a/linux/src/tests/MessageQMulti.c b/linux/src/tests/MessageQMulti.c index 475b3cf..a2c41d4 100644 --- a/linux/src/tests/MessageQMulti.c +++ b/linux/src/tests/MessageQMulti.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013, Texas Instruments Incorporated + * Copyright (c) 2012-2014, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,9 +44,9 @@ #include #include -/* SysLink/IPC Headers: */ -#include -#include +/* IPC Headers */ +#include +#include #include /* App defines: Must match on remote proc side: */ @@ -62,7 +62,7 @@ #define NUM_LOOPS_DFLT 1000 #define NUM_THREADS_DFLT 10 -#define MAX_NUM_THREADS 50 +#define MAX_NUM_THREADS 25 #define ONE_PROCESS_ONLY (-1) /** ============================================================================ @@ -189,8 +189,7 @@ int main (int argc, char ** argv) { struct thread_info threads[MAX_NUM_THREADS]; int ret,i; - void *res; - Int32 status = 0; + Int32 status = 0; /* Parse Args: */ numLoops = NUM_LOOPS_DFLT; @@ -215,19 +214,27 @@ int main (int argc, char ** argv) break; default: printf("Usage: %s [] [] [\n", - argv[0]); - printf("\tDefaults: numThreads: 10, numLoops: 100\n"); - printf("\tMax Threads: 100\n"); + argv[0]); + printf("\tDefaults: numThreads: %d, numLoops: %d\n", + NUM_THREADS_DFLT, NUM_LOOPS_DFLT); + printf("\tMax Threads: %d\n", MAX_NUM_THREADS); exit(0); } + + if (numThreads > MAX_NUM_THREADS) { + printf("Error: Maximum number of threads supported is %d\n", + MAX_NUM_THREADS); + exit(EXIT_FAILURE); + } + printf("Using numThreads: %d, numLoops: %d\n", numThreads, numLoops); if (procNum != ONE_PROCESS_ONLY) { printf("ProcNum: %d\n", procNum); } - status = SysLink_setup(); + status = Ipc_start(); if (status < 0) { - printf ("SysLink_setup failed: status = 0x%x\n", status); + printf ("Ipc_start failed: status = 0x%x\n", status); goto exit; } @@ -246,17 +253,15 @@ int main (int argc, char ** argv) /* Join all threads: */ for (i = 0; i < numThreads; i++) { - ret = pthread_join(threads[i].thread_id, &res); + ret = pthread_join(threads[i].thread_id, NULL); if (ret != 0) { printf("MessageQMulti: failed to join thread: %d, %s\n", - i, strerror(ret)); + threads[i].thread_num, strerror(ret)); } - printf("MessageQMulti: Joined with thread %d; returned value was %s\n", - threads[i].thread_num, (char *) res); - free(res); /* Free memory allocated by thread */ + printf("MessageQMulti: Joined with thread %d\n",threads[i].thread_num); } - SysLink_destroy(); + Ipc_stop(); exit: