summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eb3d6bc)
raw | patch | inline | side by side (parent: eb3d6bc)
author | vwan@ti.com <vwan@ti.com> | |
Tue, 20 May 2014 22:06:14 +0000 (15:06 -0700) | ||
committer | Robert Tivy <rtivy@ti.com> | |
Tue, 20 May 2014 22:33:54 +0000 (15:33 -0700) |
Signed-off-by: VW <vwan@ti.com>
index 0beb37cb89ec4f4d5f9fb8d659c9174443627ad9..3790cebca58ca494cde55fcc38c00c51b47c45d9 100644 (file)
/*
- * 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
#define NUM_LOOPS_DFLT 1000
#define NUM_THREADS_DFLT 10
-#define MAX_NUM_THREADS 50
+#define MAX_NUM_THREADS 55
#define ONE_PROCESS_ONLY (-1)
/** ============================================================================
break;
default:
printf("Usage: %s [<numThreads>] [<numLoops>] [<Process #]>\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);
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\n",threads[i].thread_num);
}
index ea2f2727fb557a18a781909ab71c2dac90fb2bea..17ab5fe374c7cb8e89a8de3c4245af8b0a2a9f1e 100644 (file)
/*
- * 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
#define SLAVE_MESSAGEQNAME "SLAVE"
#define HOST_MESSAGEQNAME "HOST"
-#define NUMTHREADS 10
+#define NUMTHREADS 55
#define NUMLOOPS 1000
static int numTests = 0;
diff --git a/qnx/src/tests/MessageQMulti/MessageQMulti.c b/qnx/src/tests/MessageQMulti/MessageQMulti.c
index 397376b9fb0dcb1215ebdab62800d9f90149151b..19ece589bc870bc6d1bdcb09d42e1ef97579acc8 100644 (file)
/*
- * 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
#define NUM_LOOPS_DFLT 1000
#define NUM_THREADS_DFLT 10
-#define MAX_NUM_THREADS 50
+#define MAX_NUM_THREADS 55
#define ONE_PROCESS_ONLY (-1)
/** ============================================================================
break;
default:
printf("Usage: %s [<numThreads>] [<numLoops>] [<Process #]>\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);
for (i = 0; i < numThreads; i++) {
ret = pthread_join(threads[i].thread_id, &res);
if (ret != 0) {
- printf("MessageQMulti: failed to join thread: %d, %s\n",
- i, strerror(ret));
+ printf("MessageQMulti: failed to join thread #%d, %s\n",
+ threads[i].thread_num, strerror(ret));
+ }
+ else {
+ printf("MessageQMulti: Joined with thread %d; "
+ "returned value was %p\n", threads[i].thread_num, res);
}
- printf("MessageQMulti: Joined with thread %d; returned value was %p\n",
- threads[i].thread_num, res);
free(res); /* Free memory allocated by thread */
}
diff --git a/qnx/src/tests/MessageQMulti/MessageQMulti.use b/qnx/src/tests/MessageQMulti/MessageQMulti.use
index 6321b842165bfae7777bbea11f5b958836b25dd7..0caaeb2625e623297afb3f5a24a354eab273caa6 100644 (file)
Syntax:
MessageQMulti [<numThreads>] [<numLoops>] [<Process #>]
+ Defaults: numThreads: 10, numLoops: 1000
+ Max Threads: 55
+
Examples:
MessageQMulti 10 100 Create 10 threads and each thread sends 100 msgs concurrently to slave processor