summaryrefslogtreecommitdiff
path: root/tests/Barrier_Test.cpp
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-07-02 16:07:03 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-07-02 16:07:03 +0000
commit9783f9d02b4a6e409258882e6e96f250b1cbf265 (patch)
tree486e3275690776680a42b46297f060ccdca8a772 /tests/Barrier_Test.cpp
parent9de1014a718d201e66c7d2c24365bdc6636f73f5 (diff)
downloadATCD-9783f9d02b4a6e409258882e6e96f250b1cbf265.tar.gz
On VxWorks only, to test a 0 ACE_thread_t, set the name of the last thread to 0
Diffstat (limited to 'tests/Barrier_Test.cpp')
-rw-r--r--tests/Barrier_Test.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/Barrier_Test.cpp b/tests/Barrier_Test.cpp
index 451a90c21c4..73ec4dc1783 100644
--- a/tests/Barrier_Test.cpp
+++ b/tests/Barrier_Test.cpp
@@ -51,7 +51,7 @@ static void *
tester (Tester_Args *args)
{
#if defined (VXWORKS)
- ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) %s stack size is %u\n"),
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) %s: stack size is %u\n"),
ACE_OS::thr_self (), ACE_OS::thr_min_stack ()));
#endif /* VXWORKS */
@@ -97,8 +97,11 @@ main (int, ASYS_TCHAR *[])
for (i = 0; i < n_threads; ++i)
{
- ACE_NEW_RETURN (thread_name[i], char[32], -1);
- ACE_OS::sprintf (thread_name[i], ASYS_TEXT ("thread%u"), i);
+ if (i < n_threads - 1)
+ {
+ ACE_NEW_RETURN (thread_name[i], char[32], -1);
+ ACE_OS::sprintf (thread_name[i], ASYS_TEXT ("thread%u"), i);
+ }
stack_size[i] = 40000;
}
@@ -111,6 +114,12 @@ main (int, ASYS_TCHAR *[])
ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("starting iteration %d\n"),
iteration_count));
+ // Pass an ACE_thread_t pointer of 0 for the last thread name.
+ // We have to do this for each iteration, because the
+ // thread_name location gets set on each call to spawn_n () with
+ // the actual task name.
+ thread_name[n_threads - 1] = 0;
+
if (ACE_Thread_Manager::instance ()->spawn_n
(
#if defined (VXWORKS)
@@ -135,9 +144,11 @@ main (int, ASYS_TCHAR *[])
}
#if defined (VXWORKS)
- for (i = 0; i < n_threads; ++i)
+ for (i = 0; i < n_threads - 1; ++i)
{
delete [] thread_name[i];
+ // Don't delete the last thread_name, because it points
+ // to the name in the TCB. It was initially 0.
}
delete [] thread_name;
delete [] stack_size;