summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-01-23 15:33:40 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-01-23 15:33:40 +0000
commit9ea5937386a8bc6090349359875173bc8b83f78d (patch)
treeba55b799c8cba5200d7f7b4ca554d346009fd665
parent6cd82dc33e51f357d3184c1cecf7d69fb9fa8094 (diff)
downloadATCD-9ea5937386a8bc6090349359875173bc8b83f78d.tar.gz
specify thread name and stack size on VxWorks
-rw-r--r--tests/Barrier_Test.cpp52
1 files changed, 49 insertions, 3 deletions
diff --git a/tests/Barrier_Test.cpp b/tests/Barrier_Test.cpp
index 55bb519fcd6..eaf71ee1acf 100644
--- a/tests/Barrier_Test.cpp
+++ b/tests/Barrier_Test.cpp
@@ -45,6 +45,11 @@ struct Tester_Args
static void *
tester (Tester_Args *args)
{
+#if defined (VXWORKS)
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s stack size is %u\n",
+ ACE_OS::thr_self (), ACE_OS::thr_min_stack ()));
+#endif /* VXWORKS */
+
for (int iterations = 1;
iterations <= args->n_iterations_;
iterations++)
@@ -73,6 +78,26 @@ main (int, char *[])
Tester_Args args (tester_barrier, n_iterations);
+#if defined (VXWORKS)
+ // Assign a thread (VxWorks task) name to test that feature.
+ ACE_thread_t *thread_name;
+ ACE_NEW_RETURN (thread_name, ACE_thread_t[n_threads], -1);
+
+ // And test the ability to specify stack size.
+ size_t *stack_size;
+ ACE_NEW_RETURN (stack_size, size_t[n_threads], -1);
+
+ int i;
+
+ for (i = 0; i < n_threads; ++i)
+ {
+ ACE_NEW_RETURN (thread_name[i], char[32], -1);
+ ACE_OS::sprintf (thread_name[i], "thread%u", i);
+
+ stack_size[i] = 40000;
+ }
+#endif /* VXWORKS */
+
for (size_t iteration_count = 0;
iteration_count < ACE_MAX_ITERATIONS;
iteration_count++)
@@ -81,15 +106,36 @@ main (int, char *[])
iteration_count));
if (ACE_Thread_Manager::instance ()->spawn_n
- (n_threads,
- ACE_THR_FUNC (tester),
+ (
+#if defined (VXWORKS)
+ thread_name,
+#endif /* VXWORKS */
+ n_threads,
+ (ACE_THR_FUNC) tester,
(void *) &args,
- THR_NEW_LWP | THR_JOINABLE) == -1)
+ THR_NEW_LWP | THR_JOINABLE
+#if defined (VXWORKS)
+ , ACE_DEFAULT_THREAD_PRIORITY
+ , -1
+ , 0
+ , stack_size
+#endif /* VXWORKS */
+ ) == -1)
+
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn_n"), 1);
ACE_Thread_Manager::instance ()->wait ();
}
+#if defined (VXWORKS)
+ for (i = 0; i < n_threads; ++i)
+ {
+ delete [] thread_name[i];
+ }
+ delete [] thread_name;
+ delete [] stack_size;
+#endif /* VXWORKS */
+
ACE_DEBUG ((LM_DEBUG, "test done\n"));
#else
ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n"));