summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1997-09-13 20:25:58 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1997-09-13 20:25:58 +0000
commit20574de3e8be532fdf4fe9fdc019a1b07c54e5a5 (patch)
tree6d55fa7694e195e296bd16670cc553ecba9f2f9b /tests
parent6c59c88f848bd046c5beb542cd2e4833b43bd17f (diff)
downloadATCD-20574de3e8be532fdf4fe9fdc019a1b07c54e5a5.tar.gz
*** empty log message ***
Diffstat (limited to 'tests')
-rw-r--r--tests/Reactors_Test.cpp16
-rw-r--r--tests/TSS_Test.cpp29
-rw-r--r--tests/Thread_Manager_Test.cpp21
3 files changed, 38 insertions, 28 deletions
diff --git a/tests/Reactors_Test.cpp b/tests/Reactors_Test.cpp
index abbd19fe791..01ccc00c74c 100644
--- a/tests/Reactors_Test.cpp
+++ b/tests/Reactors_Test.cpp
@@ -26,7 +26,7 @@
ACE_Thread_Manager *tm;
-static const int MAX_TASKS = 3;
+static const int MAX_TASKS = 2;
class Test_Task : public ACE_Task<ACE_MT_SYNCH>
// = TITLE
@@ -104,6 +104,10 @@ Test_Task::close (u_long)
if (Test_Task::task_count_ < 0)
abort ();
+
+ ACE_DEBUG ((LM_DEBUG, "(%t) dump in close for %x\n", this));
+ ACE_Thread_Manager::instance ()->dump ();
+
return 0;
}
@@ -217,9 +221,12 @@ main (int, char *[])
tt2[i].open (reactor);
}
+ ACE_DEBUG ((LM_DEBUG, "(%t) first dump in main\n"));
+ ACE_Thread_Manager::instance ()->dump ();
+
// Spawn two threads each running a different reactor.
- if (ACE_Thread_Manager::instance ()->spawn
+ if (ACE_Thread_Manager::instance ()->spawn
(ACE_THR_FUNC (worker),
(void *) ACE_Reactor::instance (),
THR_BOUND | THR_DETACHED) == -1)
@@ -230,11 +237,16 @@ main (int, char *[])
THR_BOUND | THR_DETACHED) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn"), -1);
+ ACE_DEBUG ((LM_DEBUG, "(%t) second dump in main\n"));
+ ACE_Thread_Manager::instance ()->dump ();
+
ACE_DEBUG ((LM_DEBUG, "(%t) starting to wait \n"));
if (ACE_Thread_Manager::instance ()->wait () == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "wait"), -1);
+ ACE_DEBUG ((LM_DEBUG, "(%t) third dump in main\n"));
+
ACE_DEBUG ((LM_DEBUG, "(%t) all threads are finished \n"));
reactor->close ();
diff --git a/tests/TSS_Test.cpp b/tests/TSS_Test.cpp
index 62f2fbebbc5..569d35af7a5 100644
--- a/tests/TSS_Test.cpp
+++ b/tests/TSS_Test.cpp
@@ -42,7 +42,7 @@ int Errno::flags_;
// This is our thread-specific error handler...
// See comment below about why it's dynamically allocated.
-static ACE_TSS<Errno> *TSS_Error;
+static ACE_TSS<Errno> *tss_error;
#if defined (ACE_HAS_THREADS)
// Serializes output via cout.
@@ -122,17 +122,17 @@ worker (void *c)
ACE_OS::read (ACE_INVALID_HANDLE, 0, 0);
// The following two lines set the thread-specific state.
- (*TSS_Error)->error (errno);
- (*TSS_Error)->line (__LINE__);
+ (*tss_error)->error (errno);
+ (*tss_error)->line (__LINE__);
// This sets the static state (note how C++ makes it easy to do
// both).
- (*TSS_Error)->flags (count);
+ (*tss_error)->flags (count);
{
// Use the guard to serialize access
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, cout_lock, 0));
- ACE_ASSERT ((*TSS_Error)->flags () == ITERATIONS);
+ ACE_ASSERT ((*tss_error)->flags () == ITERATIONS);
}
key = ACE_OS::NULL_key;
@@ -187,17 +187,17 @@ main (int, char *[])
{
ACE_START_TEST ("TSS_Test");
+#if defined (ACE_HAS_THREADS)
+
const u_int threads = ACE_MAX_THREADS;
- // Dynamically allocate TSS_Error so that we can control when
- // it gets deleted. Specifically, we need to delete it before
- // the ACE_Object_Manager destroys the ACE_Allocator. That's
- // because deletion of TSS_Error causes the internal structures
- // of ACE_TSS_Cleanup to be modified, and which in turn uses
+ // Dynamically allocate TSS_Error so that we can control when it
+ // gets deleted. Specifically, we need to delete it before the
+ // ACE_Object_Manager destroys the ACE_Allocator. That's because
+ // deletion of TSS_Error causes the internal structures of
+ // ACE_TSS_Cleanup to be modified, and which in turn uses
// ACE_Allocator.
- ACE_NEW_RETURN (TSS_Error, ACE_TSS<Errno>, 1);
-
-#if defined (ACE_HAS_THREADS)
+ ACE_NEW_RETURN (tss_error, ACE_TSS<Errno>, 1);
// Register a signal handler.
ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
@@ -235,13 +235,12 @@ main (int, char *[])
delete [] thread_handles;
+ delete tss_error;
#else
ACE_ERROR ((LM_ERROR,
"threads are not supported on this platform\n"));
#endif /* ACE_HAS_THREADS */
- delete TSS_Error;
-
ACE_END_TEST;
return 0;
}
diff --git a/tests/Thread_Manager_Test.cpp b/tests/Thread_Manager_Test.cpp
index 1cc25dbc6a3..5abeec7b172 100644
--- a/tests/Thread_Manager_Test.cpp
+++ b/tests/Thread_Manager_Test.cpp
@@ -9,17 +9,16 @@
// Thread_Manager_Test.cpp
//
// = DESCRIPTION
-// This program tests out the group management mechanisms
-// provided by the ACE_Thread_Manager, including the group signal
-// handling, group suspension and resumption, and cooperative
-// thread cancellation mechanisms.
+// This program tests the group management mechanisms provided by
+// the <ACE_Thread_Manager>, including the group signal handling,
+// group suspension and resumption, and cooperative thread
+// cancellation mechanisms.
//
// = AUTHOR
// Prashant Jain and Doug C. Schmidt
//
// ============================================================================
-
#include "ace/Service_Config.h"
#include "ace/Thread_Manager.h"
#include "test_config.h"
@@ -95,6 +94,12 @@ worker (int iterations)
static const int DEFAULT_THREADS = ACE_MAX_THREADS;
static const int DEFAULT_ITERATIONS = 100000;
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_TSS<Signal_Catcher>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_TSS<Signal_Catcher>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
#endif /* ACE_HAS_THREADS */
int
@@ -162,9 +167,3 @@ main (int, char *[])
ACE_END_TEST;
return 0;
}
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_TSS<Signal_Catcher>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_TSS<Signal_Catcher>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */