summaryrefslogtreecommitdiff
path: root/tests/TSS_Test.cpp
diff options
context:
space:
mode:
authornw1 <nw1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-08-28 08:33:01 +0000
committernw1 <nw1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-08-28 08:33:01 +0000
commitf25772e0cda8ac7268aa63ed2bdc5590b20fd39a (patch)
treea5955726d74b73b1993849f7120310e4356dc957 /tests/TSS_Test.cpp
parent61d8f73337d0cbb75bbffadd987bd15353779428 (diff)
downloadATCD-f25772e0cda8ac7268aa63ed2bdc5590b20fd39a.tar.gz
*** empty log message ***
Diffstat (limited to 'tests/TSS_Test.cpp')
-rw-r--r--tests/TSS_Test.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/tests/TSS_Test.cpp b/tests/TSS_Test.cpp
index 43ef001913d..2fb12ca9a33 100644
--- a/tests/TSS_Test.cpp
+++ b/tests/TSS_Test.cpp
@@ -172,14 +172,39 @@ main (int, char *[])
// Register a signal handler.
ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
ACE_UNUSED_ARG (sa);
+ ACE_hthread_t *thread_handles;
+
+ ACE_NEW_RETURN (thread_handles, ACE_hthread_t[ACE_MAX_THREADS], -1);
+
+ if (ACE_Thread_Manager::instance ()->spawn_n
+ ((ACE_thread_t *) 0,
+ ACE_MAX_THREADS,
+ ACE_THR_FUNC (worker),
+ (void *) ITERATIONS,
+ THR_BOUND,
+ ACE_DEFAULT_THREAD_PRIORITY,
+ -1,
+ 0,
+ 0,
+ thread_handles) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn_n"), 1);
+
+#if !defined (VXWORKS)
+ // VxWorks doesn't support thr_join() semantics... Someday
+ // we'll fix this.
+ ACE_Thread_Manager::instance ()->wait ();
+#else
+ // Wait for all the threads to reach their exit point and then join
+ // with all the exiting threads.
+ for (int i = 0;
+ i < ACE_MAX_THREADS;
+ i++)
+ if (ACE_Thread::join (thread_handles[i]) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "join"), -1);
+#endif /* VXWORKS */
- if (ACE_Thread_Manager::instance ()->spawn_n (ACE_MAX_THREADS,
- ACE_THR_FUNC (&worker),
- (void *) ITERATIONS,
- THR_BOUND | THR_DETACHED) == -1)
- ACE_OS::perror ("ACE_Thread_Manager::spawn_n");
+ delete [] thread_handles;
- ACE_Thread_Manager::instance ()->wait ();
#else
ACE_ERROR ((LM_ERROR,
"threads are not supported on this platform\n"));