summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ace/Containers.cpp3
-rw-r--r--ace/Handle_Set.cpp2
-rw-r--r--ace/OS.i41
-rw-r--r--ace/Thread_Manager.cpp13
-rw-r--r--apps/JAWS/stress_testing/http_tester.cpp10
-rw-r--r--examples/ASX/Event_Server/Event_Server/Consumer_Router.cpp2
-rw-r--r--examples/ASX/Event_Server/Event_Server/Peer_Router.cpp2
-rw-r--r--examples/ASX/Event_Server/Event_Server/Supplier_Router.cpp4
-rw-r--r--examples/ASX/Message_Queue/bounded_buffer.cpp9
-rw-r--r--examples/ASX/Message_Queue/priority_buffer.cpp5
-rw-r--r--examples/ASX/UPIPE_Event_Server/Consumer_Router.cpp3
-rw-r--r--examples/ASX/UPIPE_Event_Server/Peer_Router.cpp4
-rw-r--r--examples/ASX/UPIPE_Event_Server/Supplier_Router.cpp2
-rw-r--r--examples/Connection/blocking/SPIPE-acceptor.cpp3
-rw-r--r--examples/IPC_SAP/TLI_SAP/db-server.cpp2
-rw-r--r--examples/IPC_SAP/TLI_SAP/ftp-server.cpp1
-rw-r--r--examples/IPC_SAP/UPIPE_SAP/ex1.cpp5
-rw-r--r--examples/IPC_SAP/UPIPE_SAP/ex2.cpp4
-rw-r--r--examples/IPC_SAP/UPIPE_SAP/ex3.cpp6
-rw-r--r--examples/Reactor/Misc/test_reactors.cpp1
-rw-r--r--examples/Shared_Malloc/test_malloc.cpp4
-rw-r--r--examples/Threads/auto_event.cpp4
-rw-r--r--examples/Threads/barrier1.cpp3
-rw-r--r--examples/Threads/manual_event.cpp1
-rw-r--r--examples/Threads/process_manager.cpp2
-rw-r--r--examples/Threads/reader_writer.cpp2
-rw-r--r--examples/Threads/recursive_mutex.cpp5
-rw-r--r--examples/Threads/thread_manager.cpp2
-rw-r--r--examples/Threads/thread_specific.cpp3
-rw-r--r--netsvcs/clients/Tokens/collection/collection.cpp1
-rw-r--r--netsvcs/clients/Tokens/collection/rw_locks.cpp6
-rw-r--r--netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp6
-rw-r--r--netsvcs/clients/Tokens/invariant/invariant.cpp12
-rw-r--r--netsvcs/clients/Tokens/mutex/test_mutex.cpp8
-rw-r--r--netsvcs/clients/Tokens/rw_lock/rw_locks.cpp6
-rw-r--r--performance-tests/Synch-Benchmarks/Benchmark.cpp1
-rw-r--r--performance-tests/Synch-Benchmarks/pipe_thr_test.cpp2
-rw-r--r--tests/Barrier_Test.cpp4
-rw-r--r--tests/Conn_Test.cpp4
-rw-r--r--tests/IOStream_Test.cpp6
-rw-r--r--tests/MM_Shared_Memory_Test.cpp21
-rw-r--r--tests/Mutex_Test.cpp1
-rw-r--r--tests/Priority_Buffer_Test.cpp4
-rw-r--r--tests/Priority_Task_Test.cpp14
-rw-r--r--tests/Process_Strategy_Test.cpp4
-rw-r--r--tests/Reactor_Exceptions_Test.cpp1
-rw-r--r--tests/Reactors_Test.cpp2
-rw-r--r--tests/Reader_Writer_Test.cpp2
-rw-r--r--tests/Recursive_Mutex_Test.cpp1
-rw-r--r--tests/SOCK_Test.cpp4
-rw-r--r--tests/SPIPE_Test.cpp20
-rw-r--r--tests/Semaphore_Test.cpp1
-rw-r--r--tests/TSS_Test.cpp1
-rw-r--r--tests/Thread_Manager_Test.cpp21
-rw-r--r--tests/Tokens_Test.cpp1
55 files changed, 82 insertions, 220 deletions
diff --git a/ace/Containers.cpp b/ace/Containers.cpp
index 73f04908d68..040a6c53b87 100644
--- a/ace/Containers.cpp
+++ b/ace/Containers.cpp
@@ -410,7 +410,8 @@ ACE_Unbounded_Queue<T>::delete_nodes (void)
ACE_Node<T> *temp = curr;
curr = curr->next_;
- ACE_DES_FREE_TEMPLATE (temp, this->allocator_->free,
+ ACE_DES_FREE_TEMPLATE (temp,
+ this->allocator_->free,
ACE_Node, <T>);
this->cur_size_--;
}
diff --git a/ace/Handle_Set.cpp b/ace/Handle_Set.cpp
index 28858db233f..ce5ce1af3fa 100644
--- a/ace/Handle_Set.cpp
+++ b/ace/Handle_Set.cpp
@@ -89,7 +89,7 @@ ACE_Handle_Set::count_bits (u_long n) const
ACE_TRACE ("ACE_Handle_Set::count_bits");
int rval = 0;
- for (int i = 0; i < sizeof (u_long); i++)
+ for (int i = 0; n != 0; i++)
{
rval += ACE_Handle_Set::nbits_[n & 0xff];
n >>= 8;
diff --git a/ace/OS.i b/ace/OS.i
index 2478f0fb480..01fe810eeb8 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -1658,13 +1658,12 @@ ACE_OS::thread_mutex_unlock (ACE_thread_mutex_t *m)
#endif /* ACE_HAS_THREADS */
}
-#if ! defined (ACE_WIN32) && ! defined (VXWORKS)
-//
+#if !defined (ACE_LACKS_COND_T)
// NOTE: The ACE_OS::cond_* functions for Unix platforms are defined
-// here because the ACE_OS::sema_* functions below need them.
-// However, ACE_WIN32 and VXWORKS define the ACE_OS::cond_* functions
-// using the ACE_OS::sema_* functions. So, they appear after
-// the ACE_OS::sema_* functions.
+// here because the ACE_OS::sema_* functions below need them.
+// However, ACE_WIN32 and VXWORKS define the ACE_OS::cond_* functions
+// using the ACE_OS::sema_* functions. So, they appear after the
+// ACE_OS::sema_* functions.
ACE_INLINE int
ACE_OS::cond_destroy (ACE_cond_t *cv)
{
@@ -1856,7 +1855,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
-#endif /* ! ACE_WIN32 && ! VXWORKS */
+#endif /* !ACE_LACKS_COND_T */
ACE_INLINE int
ACE_OS::sema_destroy (ACE_sema_t *s)
@@ -2237,13 +2236,13 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
#endif /* ACE_HAS_POSIX_SEM */
}
-#if defined (ACE_WIN32) || defined (VXWORKS)
-//
-// NOTE: The ACE_OS::cond_* functions for some non-Unix platforms are defined
-// here because they need the ACE_OS::sema_* functions above.
-// However, some Unix platforms define the ACE_OS::sema_* functions
-// using the ACE_OS::cond_* functions. So, they appear before
-// the ACE_OS::sema_* functions above.
+#if defined (ACE_LACKS_COND_T)
+
+// NOTE: The ACE_OS::cond_* functions for some non-Unix platforms are
+// defined here because they need the ACE_OS::sema_* functions above.
+// However, some Unix platforms define the ACE_OS::sema_* functions
+// using the ACE_OS::cond_* functions. So, they appear before the
+// ACE_OS::sema_* functions above.
ACE_INLINE int
ACE_OS::cond_destroy (ACE_cond_t *cv)
{
@@ -2447,10 +2446,10 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
{
// ACE_TRACE ("ACE_OS::cond_timedwait");
#if defined (ACE_HAS_THREADS)
-#if defined (ACE_HAS_WTHREADS)
// Handle the easy case first.
if (timeout == 0)
return ACE_OS::cond_wait (cv, external_mutex);
+#if defined (ACE_HAS_WTHREADS)
// It's ok to increment this because the <external_mutex> must be
// locked by the caller.
@@ -2550,10 +2549,8 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
// POSIX semaphores don't have a timed wait. Should implement conds
// with VxWorks semaphores instead, they do have a timed wait. But
// all of the other cond operations would have to be modified.
- ACE_UNUSED_ARG (cv);
- ACE_UNUSED_ARG (external_mutex);
- ACE_UNUSED_ARG (timeout);
- ACE_NOTSUP_RETURN (-1);
+ else
+ return ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_WTHREADS */
#else
ACE_UNUSED_ARG (cv);
@@ -2571,7 +2568,6 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
{
// ACE_TRACE ("ACE_OS::cond_timedwait");
#if defined (ACE_HAS_THREADS)
-#if defined (ACE_HAS_WTHREADS)
// Handle the easy case first.
if (timeout == 0)
return ACE_OS::cond_wait (cv, external_mutex);
@@ -2640,7 +2636,6 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv,
ACE_OS::thread_mutex_lock (external_mutex);
errno = error;
return result;
-#endif /* ACE_HAS_WTHREADS */
#else
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
@@ -2652,7 +2647,6 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
{
// ACE_TRACE ("ACE_OS::cond_wait");
#if defined (ACE_HAS_THREADS)
-#if defined (ACE_HAS_WTHREADS)
// It's ok to increment this because the <external_mutex> must be
// locked by the caller.
cv->waiters_++;
@@ -2702,13 +2696,12 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
// Reset errno in case mutex_lock() also fails...
errno = error;
return result;
-#endif /* ACE_HAS_WTHREADS */
#else
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_THREADS */
}
#endif /* ACE_HAS_WTHREADS */
-#endif /* ACE_WIN32 || VXWORKS */
+#endif /* ACE_LACKS_COND_T */
ACE_INLINE int
ACE_OS::rw_rdlock (ACE_rwlock_t *rw)
diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp
index 198cbd80f92..9104d0ad7e4 100644
--- a/ace/Thread_Manager.cpp
+++ b/ace/Thread_Manager.cpp
@@ -271,7 +271,12 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
{
ACE_Thread_Adapter *thread_args = 0;
#if !defined (ACE_NO_THREAD_ADAPTER)
- ACE_NEW_RETURN (thread_args, ACE_Thread_Adapter (func, args, (ACE_THR_C_FUNC) ace_thread_manager_adapter), -1);
+ ACE_NEW_RETURN (thread_args,
+ ACE_Thread_Adapter (func,
+ args,
+ (ACE_THR_C_FUNC) ace_thread_manager_adapter,
+ this),
+ -1);
#endif /* ACE_NO_THREAD_ADAPTER */
ACE_TRACE ("ACE_Thread_Manager::spawn_i");
@@ -941,7 +946,9 @@ ACE_Thread_Manager::wait_task (ACE_Task_Base *task)
{
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
- copy_table = new ACE_Thread_Descriptor [this->current_count_];
+ ACE_NEW_RETURN (copy_table,
+ ACE_Thread_Descriptor [this->current_count_],
+ -1);
for (size_t i = 0; i < this->current_count_; i++)
if (this->thr_table_[i].task_ == task)
@@ -957,7 +964,7 @@ ACE_Thread_Manager::wait_task (ACE_Task_Base *task)
if (ACE_Thread::join (copy_table[i].thr_handle_) == -1)
result = -1;
- delete []copy_table;
+ delete [] copy_table;
return result;
}
diff --git a/apps/JAWS/stress_testing/http_tester.cpp b/apps/JAWS/stress_testing/http_tester.cpp
index 0491a430861..f5c092a9501 100644
--- a/apps/JAWS/stress_testing/http_tester.cpp
+++ b/apps/JAWS/stress_testing/http_tester.cpp
@@ -6,9 +6,9 @@ int Client_Parameters::tcp_nodelay;
int Client_Parameters::sockbufsiz;
Stats *Client_Parameters::stats;
-
-static void *client_thread(void *data) {
- ACE_Thread_Control tc(ACE_Thread_Manager::instance ());
+static void *
+client_thread(void *data)
+{
Client_Parameters *cp = (Client_Parameters *) data;
float latency = 0, throughput;
URL *u = cp->url;
@@ -44,8 +44,8 @@ static void *client_thread(void *data) {
num_read = webserver.read(buffer, sizeof buffer);
if(first_time) {
ACE_Profile_Timer::ACE_Elapsed_Time et;
- latency_timer.stop();
- latency_timer.elapsed_time(et);
+ latency_timer.stop();
+ latency_timer.elapsed_time(et);
latency = et.real_time;
first_time = 0;
}
diff --git a/examples/ASX/Event_Server/Event_Server/Consumer_Router.cpp b/examples/ASX/Event_Server/Event_Server/Consumer_Router.cpp
index e308c8a42d2..f76a18012e0 100644
--- a/examples/ASX/Event_Server/Event_Server/Consumer_Router.cpp
+++ b/examples/ASX/Event_Server/Event_Server/Consumer_Router.cpp
@@ -56,8 +56,6 @@ Consumer_Router::svc (void)
{
assert (this->is_writer ());
- ACE_Thread_Control tc (this->thr_mgr ());
-
ACE_DEBUG ((LM_DEBUG,
"(%t) starting svc in Consumer_Router\n"));
diff --git a/examples/ASX/Event_Server/Event_Server/Peer_Router.cpp b/examples/ASX/Event_Server/Event_Server/Peer_Router.cpp
index a54225fa916..21444a5c3bc 100644
--- a/examples/ASX/Event_Server/Event_Server/Peer_Router.cpp
+++ b/examples/ASX/Event_Server/Event_Server/Peer_Router.cpp
@@ -165,8 +165,6 @@ Peer_Handler::Peer_Handler (Peer_Router_Context *prc)
Peer_Handler::svc (void)
{
- ACE_Thread_Control thread_control (tm);
-
ACE_Message_Block *db, *hb;
int n;
diff --git a/examples/ASX/Event_Server/Event_Server/Supplier_Router.cpp b/examples/ASX/Event_Server/Event_Server/Supplier_Router.cpp
index 1fa7b4534db..0ab012eaa4a 100644
--- a/examples/ASX/Event_Server/Event_Server/Supplier_Router.cpp
+++ b/examples/ASX/Event_Server/Event_Server/Supplier_Router.cpp
@@ -10,8 +10,6 @@ Supplier_Router::svc (void)
{
assert (this->is_writer ());
- ACE_Thread_Control tc (this->thr_mgr ());
-
ACE_DEBUG ((LM_DEBUG, "(%t) starting svc in Supplier_Router\n"));
for (ACE_Message_Block *mb = 0;
@@ -31,8 +29,6 @@ Supplier_Router::svc (void)
ACE_DEBUG ((LM_DEBUG, "(%t) stopping svc in Supplier_Router\n"));
return 0;
- // Note the implicit ACE_OS::thr_exit() via ACE_Thread_Control's
- // destructor.
}
Supplier_Router::Supplier_Router (Peer_Router_Context *prc)
diff --git a/examples/ASX/Message_Queue/bounded_buffer.cpp b/examples/ASX/Message_Queue/bounded_buffer.cpp
index 1d217eff86a..e0ea691d433 100644
--- a/examples/ASX/Message_Queue/bounded_buffer.cpp
+++ b/examples/ASX/Message_Queue/bounded_buffer.cpp
@@ -21,9 +21,6 @@ static ACE_Thread_Manager thr_mgr;
static void *
producer (ACE_Message_Queue<ACE_MT_SYNCH> *msg_queue)
{
- // Insert thread into thr_mgr.
- ACE_Thread_Control thread_control (&thr_mgr);
-
// Keep reading stdin, until we reach EOF.
for (int n; ; )
@@ -54,8 +51,6 @@ producer (ACE_Message_Queue<ACE_MT_SYNCH> *msg_queue)
}
}
- // The destructor of ACE_Thread_Control removes the exiting thread
- // from the thr_mgr automatically.
return 0;
}
@@ -66,8 +61,6 @@ producer (ACE_Message_Queue<ACE_MT_SYNCH> *msg_queue)
static void *consumer (ACE_Message_Queue<ACE_MT_SYNCH> *msg_queue)
{
- // Insert thread into thr_mgr.
- ACE_Thread_Control thread_control (&thr_mgr);
int result = 0;
// Keep looping, reading a message out of the queue, until we timeout
@@ -98,8 +91,6 @@ static void *consumer (ACE_Message_Queue<ACE_MT_SYNCH> *msg_queue)
if (result == -1 && errno == EWOULDBLOCK)
ACE_ERROR ((LM_ERROR, "(%t) %p\n%a", "timed out waiting for message", 1));
- // The destructor of ACE_Thread_Control removes the exiting thread
- // from the thr_mgr automatically.
return 0;
}
diff --git a/examples/ASX/Message_Queue/priority_buffer.cpp b/examples/ASX/Message_Queue/priority_buffer.cpp
index 5ae318d5349..52976df02d5 100644
--- a/examples/ASX/Message_Queue/priority_buffer.cpp
+++ b/examples/ASX/Message_Queue/priority_buffer.cpp
@@ -61,9 +61,6 @@ consumer (ACE_Message_Queue<ACE_MT_SYNCH> *msg_queue)
static void *
producer (ACE_Message_Queue<ACE_MT_SYNCH> *msg_queue)
{
- // Insert thread into thr_mgr.
- ACE_Thread_Control thread_control (&thr_mgr);
-
ACE_Read_Buffer rb (ACE_STDIN);
// Keep reading stdin, until we reach EOF.
@@ -114,8 +111,6 @@ producer (ACE_Message_Queue<ACE_MT_SYNCH> *msg_queue)
// the size of the lines!).
consumer (msg_queue);
- // The destructor of ACE_Thread_Control removes the exiting thread
- // from the thr_mgr automatically.
return 0;
}
diff --git a/examples/ASX/UPIPE_Event_Server/Consumer_Router.cpp b/examples/ASX/UPIPE_Event_Server/Consumer_Router.cpp
index d797d6668b5..2480a90c94b 100644
--- a/examples/ASX/UPIPE_Event_Server/Consumer_Router.cpp
+++ b/examples/ASX/UPIPE_Event_Server/Consumer_Router.cpp
@@ -65,7 +65,6 @@ Consumer_Router::close (u_long)
int
Consumer_Router::svc (void)
{
- ACE_Thread_Control tc (this->thr_mgr ());
ACE_Message_Block *mb = 0;
ACE_ASSERT (this->is_reader ());
@@ -74,11 +73,9 @@ Consumer_Router::svc (void)
ACE_DEBUG ((LM_DEBUG, "(%t) starting svc in %s\n", this->name ()));
while (this->getq (mb) > 0)
- {
if (this->put_next (mb) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "(%t) put_next failed in %s\n", this->name ()), -1);
- }
return 0;
// Note the implicit ACE_OS::thr_exit() via destructor.
}
diff --git a/examples/ASX/UPIPE_Event_Server/Peer_Router.cpp b/examples/ASX/UPIPE_Event_Server/Peer_Router.cpp
index b5ee51ff748..d87ed2b263f 100644
--- a/examples/ASX/UPIPE_Event_Server/Peer_Router.cpp
+++ b/examples/ASX/UPIPE_Event_Server/Peer_Router.cpp
@@ -64,9 +64,7 @@ Peer_Handler<ROUTER, KEY>::Peer_Handler (ACE_Thread_Manager *tm)
template <class ROUTER, class KEY> int
Peer_Handler<ROUTER, KEY>::svc (void)
{
- ACE_Thread_Control thread_control (tm);
- // just a try !!
- // we're just reading from our ACE_Message_Queue
+ // Just a try !! we're just reading from our ACE_Message_Queue.
ACE_Message_Block *db, *hb;
int n;
// do an endless loop
diff --git a/examples/ASX/UPIPE_Event_Server/Supplier_Router.cpp b/examples/ASX/UPIPE_Event_Server/Supplier_Router.cpp
index e0956ed6215..eec07043de8 100644
--- a/examples/ASX/UPIPE_Event_Server/Supplier_Router.cpp
+++ b/examples/ASX/UPIPE_Event_Server/Supplier_Router.cpp
@@ -34,7 +34,6 @@ Supplier_Router::svc (void)
{
ACE_ASSERT (this->is_writer ());
- ACE_Thread_Control tc (this->thr_mgr ());
ACE_Message_Block *message_block = 0;
if (options.debug ())
@@ -47,7 +46,6 @@ Supplier_Router::svc (void)
}
return 0;
- // Note the implicit ACE_OS::thr_exit() via ACE_Thread_Control's destructor.
}
// Initialize the Router..
diff --git a/examples/Connection/blocking/SPIPE-acceptor.cpp b/examples/Connection/blocking/SPIPE-acceptor.cpp
index c103dbb82a0..4a712e4befc 100644
--- a/examples/Connection/blocking/SPIPE-acceptor.cpp
+++ b/examples/Connection/blocking/SPIPE-acceptor.cpp
@@ -123,7 +123,6 @@ IPC_Server::parse_args (int argc, char *argv[])
static void *
run_reactor_event_loop (void *)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
ACE_DEBUG ((LM_DEBUG, "(%t) worker thread starting\n"));
ACE_Proactor::run_event_loop ();
@@ -157,7 +156,7 @@ IPC_Server::svc (void)
{
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn_n"), 1);
- ACE_Thread_Manager::instance ()->wait ();
+ ACE_Thread_Manager::instance ()->wait ();
}
ACE_DEBUG ((LM_DEBUG, "(%t) main thread exiting.\n"));
diff --git a/examples/IPC_SAP/TLI_SAP/db-server.cpp b/examples/IPC_SAP/TLI_SAP/db-server.cpp
index 0323b686320..ca4a63abb10 100644
--- a/examples/IPC_SAP/TLI_SAP/db-server.cpp
+++ b/examples/IPC_SAP/TLI_SAP/db-server.cpp
@@ -13,8 +13,6 @@ ACE_Thread_Manager thr_mgr;
void *
lookup_name (ACE_HANDLE handle)
{
- ACE_Thread_Control tc (&thr_mgr);
-
enum
{
MAXLINE = 255,
diff --git a/examples/IPC_SAP/TLI_SAP/ftp-server.cpp b/examples/IPC_SAP/TLI_SAP/ftp-server.cpp
index 046f4dc0464..a05d1aa55c8 100644
--- a/examples/IPC_SAP/TLI_SAP/ftp-server.cpp
+++ b/examples/IPC_SAP/TLI_SAP/ftp-server.cpp
@@ -12,7 +12,6 @@ ACE_Thread_Manager thr_mgr;
void *
read_file (void *fd)
{
- ACE_Thread_Control tc (&thr_mgr);
ACE_TLI_Stream stream;
char buf[BUFSIZ];
int flags = 0;
diff --git a/examples/IPC_SAP/UPIPE_SAP/ex1.cpp b/examples/IPC_SAP/UPIPE_SAP/ex1.cpp
index 95119696b23..5c98f6ed624 100644
--- a/examples/IPC_SAP/UPIPE_SAP/ex1.cpp
+++ b/examples/IPC_SAP/UPIPE_SAP/ex1.cpp
@@ -25,8 +25,6 @@ static ACE_UPIPE_Addr addr ("pattern");
static void *
peer1 (void *)
{
- // Insert thread into thr_mgr.
- ACE_Thread_Control thread_control (&thr_mgr);
ACE_UPIPE_Stream c_stream;
ACE_DEBUG ((LM_DEBUG, "(%t) peer1 starting connect\n"));
@@ -81,9 +79,6 @@ peer1 (void *)
static void *
peer2 (void *)
{
- // Insert thread into thr_mgr.
- ACE_Thread_Control thread_control (&thr_mgr);
-
ACE_UPIPE_Acceptor acc (addr);
ACE_UPIPE_Stream s_stream;
diff --git a/examples/IPC_SAP/UPIPE_SAP/ex2.cpp b/examples/IPC_SAP/UPIPE_SAP/ex2.cpp
index 4898f7240f4..6efddd0ffed 100644
--- a/examples/IPC_SAP/UPIPE_SAP/ex2.cpp
+++ b/examples/IPC_SAP/UPIPE_SAP/ex2.cpp
@@ -23,8 +23,6 @@ int iterations = 0;
static void *
supplier (void *)
{
- // Insert thread into thr_mgr.
- ACE_Thread_Control thread_control (&thr_mgr);
ACE_UPIPE_Stream s_stream;
ACE_UPIPE_Addr c_addr ("pattern");
@@ -73,8 +71,6 @@ supplier (void *)
static void *
consumer (void *)
{
- // Insert thread into thr_mgr.
- ACE_Thread_Control thread_control (&thr_mgr);
ACE_UPIPE_Stream c_stream;
// Set the high water mark to size to achieve optimum performance.
diff --git a/examples/IPC_SAP/UPIPE_SAP/ex3.cpp b/examples/IPC_SAP/UPIPE_SAP/ex3.cpp
index e947f5889f9..bc86b5d5377 100644
--- a/examples/IPC_SAP/UPIPE_SAP/ex3.cpp
+++ b/examples/IPC_SAP/UPIPE_SAP/ex3.cpp
@@ -24,9 +24,6 @@ int iterations = 0;
static void *
supplier (void *)
{
- // Insert thread into thr_mgr.
- ACE_Thread_Control thread_control (&thr_mgr);
-
ACE_UPIPE_Stream s_stream;
ACE_UPIPE_Addr c_addr ("pattern");
@@ -65,9 +62,6 @@ supplier (void *)
static void *
consumer (void *)
{
- // Insert thread into thr_mgr.
- ACE_Thread_Control thread_control (&thr_mgr);
-
ACE_UPIPE_Stream c_stream;
ACE_UPIPE_Addr serv_addr ("pattern");
diff --git a/examples/Reactor/Misc/test_reactors.cpp b/examples/Reactor/Misc/test_reactors.cpp
index 43201feca9b..72b25e5a2cb 100644
--- a/examples/Reactor/Misc/test_reactors.cpp
+++ b/examples/Reactor/Misc/test_reactors.cpp
@@ -126,7 +126,6 @@ Test_Task::handle_input (ACE_HANDLE)
static void *
worker (void *args)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
ACE_Reactor *reactor = (ACE_Reactor *) args;
reactor->owner (ACE_Thread::self ());
diff --git a/examples/Shared_Malloc/test_malloc.cpp b/examples/Shared_Malloc/test_malloc.cpp
index fa90272306c..f32965126ce 100644
--- a/examples/Shared_Malloc/test_malloc.cpp
+++ b/examples/Shared_Malloc/test_malloc.cpp
@@ -65,10 +65,6 @@ malloc_recurse (int count)
static void *
worker (void *arg)
{
- // Allocate a thread control object, which automatically removes the
- // thread from the thread manager on exit.
- ACE_Thread_Control tc (&thread_manager);
-
malloc_recurse ((int) arg);
return 0;
}
diff --git a/examples/Threads/auto_event.cpp b/examples/Threads/auto_event.cpp
index 1b1e1f36448..a49c1bdea23 100644
--- a/examples/Threads/auto_event.cpp
+++ b/examples/Threads/auto_event.cpp
@@ -30,8 +30,6 @@ reader (void *arg)
// Shared data via a reference.
int& data = *(int *) arg;
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
-
// Wait for writer to complete.
ACE_DEBUG ((LM_DEBUG, "(%t) reader: waiting...... \n"));
@@ -54,8 +52,6 @@ writer (void *arg)
{
int& data = *(int *) arg;
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
-
// Calculate (work).
ACE_DEBUG ((LM_DEBUG, "(%t) writer: working for %d secs\n", work_time));
ACE_OS::sleep (work_time);
diff --git a/examples/Threads/barrier1.cpp b/examples/Threads/barrier1.cpp
index 3800e7cc84d..bc8a3c22c7a 100644
--- a/examples/Threads/barrier1.cpp
+++ b/examples/Threads/barrier1.cpp
@@ -32,9 +32,6 @@ struct Tester_Args
static void *
tester (Tester_Args *args)
{
- // Keeps track of thread exit.
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
-
for (int iterations = 1;
iterations <= args->n_iterations_;
iterations++)
diff --git a/examples/Threads/manual_event.cpp b/examples/Threads/manual_event.cpp
index 886207e71fe..7df22fa2961 100644
--- a/examples/Threads/manual_event.cpp
+++ b/examples/Threads/manual_event.cpp
@@ -56,7 +56,6 @@ Pseudo_Barrier::wait (void)
static void *
worker (void *arg)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
Pseudo_Barrier &barrier = *(Pseudo_Barrier *) arg;
// work
diff --git a/examples/Threads/process_manager.cpp b/examples/Threads/process_manager.cpp
index 9b7a489d5cb..8813e379235 100644
--- a/examples/Threads/process_manager.cpp
+++ b/examples/Threads/process_manager.cpp
@@ -14,8 +14,6 @@ static ACE_Process_Manager proc_mgr;
void *
sig_handler (void *)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
-
ACE_Sig_Set sigset;
// Register a dummy signal handler so that our disposition isn't
diff --git a/examples/Threads/reader_writer.cpp b/examples/Threads/reader_writer.cpp
index d43af5ab46f..7d59c36ad8c 100644
--- a/examples/Threads/reader_writer.cpp
+++ b/examples/Threads/reader_writer.cpp
@@ -78,7 +78,6 @@ parse_args (int argc, char *argv[])
static void *
reader (void *)
{
- ACE_Thread_Control tc (&thr_mgr);
ACE_DEBUG ((LM_DEBUG, "(%t) reader starting\n"));
for (int iterations = 1;
@@ -116,7 +115,6 @@ reader (void *)
static void *
writer (void *)
{
- ACE_Thread_Control tc (&thr_mgr);
ACE_DEBUG ((LM_DEBUG, "(%t) writer starting\n"));
for (int iterations = 1;
diff --git a/examples/Threads/recursive_mutex.cpp b/examples/Threads/recursive_mutex.cpp
index c2b398a3634..adc1507b6ed 100644
--- a/examples/Threads/recursive_mutex.cpp
+++ b/examples/Threads/recursive_mutex.cpp
@@ -74,9 +74,8 @@ recursive_worker (size_t nesting_level,
static void *
worker (void *arg)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
-
- ACE_Recursive_Thread_Mutex *rm = (ACE_Recursive_Thread_Mutex *) arg;
+ ACE_Recursive_Thread_Mutex *rm
+ = (ACE_Recursive_Thread_Mutex *) arg;
recursive_worker (0, rm);
return 0;
diff --git a/examples/Threads/thread_manager.cpp b/examples/Threads/thread_manager.cpp
index 790b591e650..e740ff9bcc6 100644
--- a/examples/Threads/thread_manager.cpp
+++ b/examples/Threads/thread_manager.cpp
@@ -19,8 +19,6 @@ handler (int signum)
static void *
worker (int iterations)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
-
for (int i = 0; i < iterations; i++)
{
if ((i % 1000) == 0)
diff --git a/examples/Threads/thread_specific.cpp b/examples/Threads/thread_specific.cpp
index aacad3dd747..f56317c2a1e 100644
--- a/examples/Threads/thread_specific.cpp
+++ b/examples/Threads/thread_specific.cpp
@@ -79,7 +79,6 @@ cleanup (void *ptr)
static void *
worker (void *c)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
int count = int (c);
ACE_thread_key_t key = ACE_OS::NULL_key;
@@ -178,7 +177,7 @@ main (int argc, char *argv[])
{
// The Service_Config must be the first object defined in main...
ACE_Service_Config daemon (argv[0]);
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
+
int threads = argc > 1 ? ACE_OS::atoi (argv[1]) : 4;
int count = argc > 2 ? ACE_OS::atoi (argv[2]) : 10000;
diff --git a/netsvcs/clients/Tokens/collection/collection.cpp b/netsvcs/clients/Tokens/collection/collection.cpp
index 6d481a976b8..44e0b0a2bbd 100644
--- a/netsvcs/clients/Tokens/collection/collection.cpp
+++ b/netsvcs/clients/Tokens/collection/collection.cpp
@@ -41,7 +41,6 @@ static int remote = 0;
static void *
run_thread (void *vp)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
ACE_Token_Proxy *collection = (ACE_Token_Proxy *) vp;
int count = iterations;
diff --git a/netsvcs/clients/Tokens/collection/rw_locks.cpp b/netsvcs/clients/Tokens/collection/rw_locks.cpp
index 1e26744338f..6fd852ff97e 100644
--- a/netsvcs/clients/Tokens/collection/rw_locks.cpp
+++ b/netsvcs/clients/Tokens/collection/rw_locks.cpp
@@ -25,9 +25,6 @@ static int write_sleep = 0;
static void *
run_thread (void *vp)
{
- ACE_Thread_Manager *thr_mgr = (ACE_Thread_Manager*) vp;
- ACE_Thread_Control tc (thr_mgr);
-
for (int x = 0; x < iterations; x++)
{
int y = 0;
@@ -154,7 +151,8 @@ main (int argc, char* argv[])
ACE_Thread_Manager mgr;
if (mgr.spawn_n (threads, ACE_THR_FUNC (run_thread),
- (void *) &mgr, THR_BOUND | THR_SUSPENDED) == -1)
+ (void *) &0,
+ THR_BOUND | THR_SUSPENDED) == -1)
ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn failed"), -1);
if (mgr.resume_all () == -1)
diff --git a/netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp b/netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp
index 496e418a159..b36040e789a 100644
--- a/netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp
+++ b/netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp
@@ -60,8 +60,7 @@ static int rwlocks = 0;
static void *
two_token_thread (void *vp)
{
- Two_Tokens* tm = (Two_Tokens*) vp;
- ACE_Thread_Control (tm->thr_mgr_);
+ Two_Tokens* tm = (Two_Tokens *) vp;
for (int x = 0; x < iterations; x++)
{
@@ -105,8 +104,7 @@ two_token_thread (void *vp)
static void *
run_writer (void *vp)
{
- Four_Tokens* ft = (Four_Tokens *) vp;
- ACE_Thread_Control (ft->thr_mgr_);
+ Four_Tokens *ft = (Four_Tokens *) vp;
int acquire_number = 0;
for (int x = 0; x < iterations; x++)
diff --git a/netsvcs/clients/Tokens/invariant/invariant.cpp b/netsvcs/clients/Tokens/invariant/invariant.cpp
index 551eb79c530..9ee49feee86 100644
--- a/netsvcs/clients/Tokens/invariant/invariant.cpp
+++ b/netsvcs/clients/Tokens/invariant/invariant.cpp
@@ -32,9 +32,6 @@ static char * mutexname = "mutex";
static void *
run_reader_writer (void *vp)
{
- ACE_Thread_Manager *thr_mgr = (ACE_Thread_Manager*) vp;
- ACE_Thread_Control tc (thr_mgr);
-
for (int x = 0; x < 50; x++)
{
int y = 0;
@@ -81,9 +78,6 @@ run_reader_writer (void *vp)
static void *
run_mutex (void *vp)
{
- ACE_Thread_Manager *thr_mgr = (ACE_Thread_Manager*) vp;
- ACE_Thread_Control tc (thr_mgr);
-
for (int x = 0; x < 50; x++)
{
if (ACE_TOKEN_INVARIANTS::instance ()->mutex_acquired (mutexname) == 0)
@@ -169,7 +163,8 @@ main (int /* argc */, char* /* argv */ [])
// Run reader/writer test
if (mgr.spawn_n (2, ACE_THR_FUNC (run_reader_writer),
- (void *) &mgr, THR_NEW_LWP | THR_DETACHED) == -1)
+ (void *) 0,
+ THR_NEW_LWP | THR_DETACHED) == -1)
ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn failed"), -1);
mgr.wait ();
@@ -178,7 +173,8 @@ main (int /* argc */, char* /* argv */ [])
// Run mutex test.
if (mgr.spawn_n (2, ACE_THR_FUNC (run_mutex),
- (void *) &mgr, THR_NEW_LWP | THR_DETACHED) == -1)
+ (void *) 0,
+ THR_NEW_LWP | THR_DETACHED) == -1)
ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn failed"), -1);
mgr.wait ();
diff --git a/netsvcs/clients/Tokens/mutex/test_mutex.cpp b/netsvcs/clients/Tokens/mutex/test_mutex.cpp
index 1161928f477..3f6b723bdc1 100644
--- a/netsvcs/clients/Tokens/mutex/test_mutex.cpp
+++ b/netsvcs/clients/Tokens/mutex/test_mutex.cpp
@@ -35,9 +35,6 @@ static int spawn_count = 2;
static void *
run_test (void *vp)
{
- ACE_Thread_Manager *thr_mgr = (ACE_Thread_Manager*) vp;
- ACE_Thread_Control tc (thr_mgr);
-
int count = iterations;
// test recursive acquisition of a global proxy
while (count--)
@@ -110,7 +107,7 @@ parse_args (int argc, char *argv[])
}
int
-main (int argc, char* argv[])
+main (int argc, char *argv[])
{
ACE_Thread_Manager thread_mgr;
@@ -129,7 +126,8 @@ main (int argc, char* argv[])
if (thread_mgr.spawn_n (spawn_count,
ACE_THR_FUNC (run_test),
- (void *) &thread_mgr, THR_BOUND) == -1)
+ 0,
+ THR_BOUND) == -1)
ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn"), -1);
thread_mgr.wait ();
diff --git a/netsvcs/clients/Tokens/rw_lock/rw_locks.cpp b/netsvcs/clients/Tokens/rw_lock/rw_locks.cpp
index 7f406da0685..0c9170b3828 100644
--- a/netsvcs/clients/Tokens/rw_lock/rw_locks.cpp
+++ b/netsvcs/clients/Tokens/rw_lock/rw_locks.cpp
@@ -46,9 +46,6 @@ static int renew = 0;
static void *
run_thread (void *vp)
{
- ACE_Thread_Manager *thr_mgr = (ACE_Thread_Manager*) vp;
- ACE_Thread_Control tc (thr_mgr);
-
for (int x = 0; x < iterations; x++)
{
int y = 0;
@@ -231,7 +228,8 @@ main (int argc, char* argv[])
ACE_Thread_Manager mgr;
if (mgr.spawn_n (threads, ACE_THR_FUNC (run_thread),
- (void *) &mgr, THR_BOUND | SUSPEND) == -1)
+ (void *) 0,
+ THR_BOUND | SUSPEND) == -1)
ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn failed"), -1);
#if ! defined (ACE_HAS_PTHREADS)
diff --git a/performance-tests/Synch-Benchmarks/Benchmark.cpp b/performance-tests/Synch-Benchmarks/Benchmark.cpp
index a0558e9b2c3..e5e8a1f2001 100644
--- a/performance-tests/Synch-Benchmarks/Benchmark.cpp
+++ b/performance-tests/Synch-Benchmarks/Benchmark.cpp
@@ -63,7 +63,6 @@ Benchmark::fini (void)
void *
Benchmark::svc_run (Benchmark *bp)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
return (void *) (bp->svc () == -1 ? -1 : 0);
}
diff --git a/performance-tests/Synch-Benchmarks/pipe_thr_test.cpp b/performance-tests/Synch-Benchmarks/pipe_thr_test.cpp
index 4e75ebfc0dd..ff067b41532 100644
--- a/performance-tests/Synch-Benchmarks/pipe_thr_test.cpp
+++ b/performance-tests/Synch-Benchmarks/pipe_thr_test.cpp
@@ -22,8 +22,6 @@ private:
void *
Pipe_Thr_Test::reader (Pipe_Thr_Test *t)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
-
ACE_HANDLE handle = t->pipe_handles[0];
int ni = t->thr_id ();
size_t length = options.msg_size ();
diff --git a/tests/Barrier_Test.cpp b/tests/Barrier_Test.cpp
index 999434a7c5f..b34b262312d 100644
--- a/tests/Barrier_Test.cpp
+++ b/tests/Barrier_Test.cpp
@@ -48,10 +48,6 @@ tester (Tester_Args *args)
{
ACE_NEW_THREAD;
-#if defined (VXWORKS)
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
-#endif /* VXWORKS */
-
for (int iterations = 1;
iterations <= args->n_iterations_;
iterations++)
diff --git a/tests/Conn_Test.cpp b/tests/Conn_Test.cpp
index 3f5f03d8ed7..6e7b4c5eee2 100644
--- a/tests/Conn_Test.cpp
+++ b/tests/Conn_Test.cpp
@@ -353,8 +353,6 @@ static void *
client (void *arg)
{
#if (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS)
- // Insert thread into thr_mgr
- ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
#endif /* (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) */
@@ -389,8 +387,6 @@ static void *
server (void *arg)
{
#if (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS)
- // Insert thread into thr_mgr
- ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
#endif /* (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) */
diff --git a/tests/IOStream_Test.cpp b/tests/IOStream_Test.cpp
index 73bea0ab44e..764643cf328 100644
--- a/tests/IOStream_Test.cpp
+++ b/tests/IOStream_Test.cpp
@@ -154,10 +154,6 @@ client (void *arg = 0)
ACE_NEW_THREAD;
ACE_UNUSED_ARG (arg);
-#if defined (ACE_HAS_THREADS)
- ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
-#endif /* ACE_HAS_THREADS */
-
// We don't _need_ to dynamically allocate the ACE_SOCK_IOStream.
// But if we don't, it doesn't get destroyed on some platforms, e.g.,
// g++ 2.7.2.1 and Sun C++ 4.2 on Solaris 2.5.1. (It does work on
@@ -265,8 +261,6 @@ server (void *arg = 0)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "get_local_addr"), 0);
#if defined (ACE_HAS_THREADS)
- ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
-
if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (client),
(void *) &server_addr,
THR_NEW_LWP | THR_DETACHED) == -1)
diff --git a/tests/MM_Shared_Memory_Test.cpp b/tests/MM_Shared_Memory_Test.cpp
index 6149e201fda..c7045bc28e9 100644
--- a/tests/MM_Shared_Memory_Test.cpp
+++ b/tests/MM_Shared_Memory_Test.cpp
@@ -29,15 +29,10 @@
const int SHMSZ = 27;
static TCHAR shm_key[] = ACE_TEMP_FILE_NAME __TEXT ("XXXXXX");
-// Global thread manager.
-static ACE_Thread_Manager thr_mgr;
-
static void *
client (void *)
{
#if defined (ACE_WIN32) || defined (VXWORKS)
- // Insert thread into thr_mgr
- ACE_Thread_Control thread_control (&thr_mgr);
ACE_NEW_THREAD;
#endif /* ACE_WIN32 */
@@ -62,8 +57,6 @@ static void *
server (void *)
{
#if defined (ACE_WIN32) || defined (VXWORKS)
- // Insert thread into thr_mgr
- ACE_Thread_Control thread_control (&thr_mgr);
ACE_NEW_THREAD;
#endif /* ACE_WIN32 */
@@ -103,16 +96,16 @@ spawn (void)
server (0);
}
#elif defined (ACE_HAS_THREADS)
- if (thr_mgr.spawn (ACE_THR_FUNC (client),
- (void *) 0,
- THR_NEW_LWP | THR_DETACHED) == -1)
+ if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (client),
+ (void *) 0,
+ THR_NEW_LWP | THR_DETACHED) == -1)
ACE_ERROR ((LM_ERROR, "%p\n%a", "thread create failed"));
- if (thr_mgr.spawn (ACE_THR_FUNC (server),
- (void *) 0,
- THR_NEW_LWP | THR_DETACHED) == -1)
+ if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (server),
+ (void *) 0,
+ THR_NEW_LWP | THR_DETACHED) == -1)
ACE_ERROR ((LM_ERROR, "%p\n%a", "thread create failed"));
- thr_mgr.wait ();
+ ACE_Thread_Manager::instance ()->wait ();
#else
ACE_ERROR ((LM_ERROR, "only one thread may be run in a process on this platform\n%a", 1));
#endif /* ACE_HAS_THREADS */
diff --git a/tests/Mutex_Test.cpp b/tests/Mutex_Test.cpp
index 3cb23cc978f..85694dc86b2 100644
--- a/tests/Mutex_Test.cpp
+++ b/tests/Mutex_Test.cpp
@@ -27,7 +27,6 @@ test (void *args)
{
ACE_Process_Mutex *pm = (ACE_Process_Mutex *) args;
#if (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS)
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
#endif /* (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) */
diff --git a/tests/Priority_Buffer_Test.cpp b/tests/Priority_Buffer_Test.cpp
index 50bf7cb1e2e..82afc79cc93 100644
--- a/tests/Priority_Buffer_Test.cpp
+++ b/tests/Priority_Buffer_Test.cpp
@@ -19,7 +19,6 @@
//
// ============================================================================
-
#include "ace/Message_Queue.h"
#include "ace/Service_Config.h"
#include "test_config.h"
@@ -89,7 +88,6 @@ producer (void *args)
ACE_Message_Queue<ACE_MT_SYNCH> *msg_queue = (ACE_Message_Queue<ACE_MT_SYNCH> *) args;
// Insert thread into thr_mgr.
- ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
ACE_Message_Block *mb = 0;
@@ -124,8 +122,6 @@ producer (void *args)
// the size of the lines!).
consumer (msg_queue);
- // The destructor of ACE_Thread_Control removes the exiting thread
- // from the thr_mgr automatically.
return 0;
}
diff --git a/tests/Priority_Task_Test.cpp b/tests/Priority_Task_Test.cpp
index 5d8f9c7163f..f08f20c99b8 100644
--- a/tests/Priority_Task_Test.cpp
+++ b/tests/Priority_Task_Test.cpp
@@ -37,7 +37,7 @@ private:
};
Priority_Task::Priority_Task (void)
-: ACE_Task<ACE_MT_SYNCH> (ACE_Thread_Manager::instance ()),
+ : ACE_Task<ACE_MT_SYNCH> (ACE_Thread_Manager::instance ()),
priority_ (0)
{
}
@@ -55,10 +55,10 @@ Priority_Task::open (void *arg)
// Become an active object.
if (this->activate (flags, 1, 0, this->priority_) == -1)
{
- // On Linux, only the superuser can set the policy to other
- // than ACE_SCHED_OTHER. But with ACE_SCHED_OTHER, there is
- // only 1 thread priority value, 0. So, let the superuser
- // run an interesting test, but for other users use priority 0.
+ // On Linux, only the superuser can set the policy to other than
+ // ACE_SCHED_OTHER. But with ACE_SCHED_OTHER, there is only 1
+ // thread priority value, 0. So, let the superuser run an
+ // interesting test, but for other users use priority 0.
ACE_DEBUG ((LM_DEBUG, "(%t) task activation at priority %d with flags "
"%ld failed; retry at priority 0 with with flags "
@@ -69,9 +69,7 @@ Priority_Task::open (void *arg)
this->priority_ = 0;
if (this->activate (flags, 1, 1, this->priority_) == -1)
- {
- ACE_DEBUG ((LM_ERROR, "(%t) task activation at priority 0 failed, exiting!\n%a", -1));
- }
+ ACE_DEBUG ((LM_ERROR, "(%t) task activation at priority 0 failed, exiting!\n%a", -1));
}
return 0;
diff --git a/tests/Process_Strategy_Test.cpp b/tests/Process_Strategy_Test.cpp
index 611bc262763..7cae8fb9a7d 100644
--- a/tests/Process_Strategy_Test.cpp
+++ b/tests/Process_Strategy_Test.cpp
@@ -367,8 +367,6 @@ static void *
client (void *arg)
{
#if (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS)
- // Insert thread into thr_mgr
- ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
#endif /* (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) */
@@ -454,8 +452,6 @@ static void *
server (void *)
{
#if (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS)
- // Insert thread into thr_mgr
- ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
#endif /* (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) */
diff --git a/tests/Reactor_Exceptions_Test.cpp b/tests/Reactor_Exceptions_Test.cpp
index df7b50a7f4b..511b27158ba 100644
--- a/tests/Reactor_Exceptions_Test.cpp
+++ b/tests/Reactor_Exceptions_Test.cpp
@@ -95,7 +95,6 @@ static int
worker (void)
{
ACE_NEW_THREAD;
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
ACE_Reactor::instance()->owner (ACE_OS::thr_self());
diff --git a/tests/Reactors_Test.cpp b/tests/Reactors_Test.cpp
index 047c1bef5e9..9a168ba22c2 100644
--- a/tests/Reactors_Test.cpp
+++ b/tests/Reactors_Test.cpp
@@ -145,8 +145,6 @@ worker (void *args)
{
ACE_NEW_THREAD;
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
-
ACE_Reactor *reactor = (ACE_Reactor *) args;
// Make this thread the owner of the Reactor's event loop.
diff --git a/tests/Reader_Writer_Test.cpp b/tests/Reader_Writer_Test.cpp
index 27f346ba894..759cc664285 100644
--- a/tests/Reader_Writer_Test.cpp
+++ b/tests/Reader_Writer_Test.cpp
@@ -88,7 +88,6 @@ parse_args (int argc, char *argv[])
static void *
reader (void *)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
ACE_DEBUG ((LM_DEBUG, " (%t) reader starting\n"));
@@ -134,7 +133,6 @@ reader (void *)
static void *
writer (void *)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
ACE_DEBUG ((LM_DEBUG, " (%t) writer starting\n"));
diff --git a/tests/Recursive_Mutex_Test.cpp b/tests/Recursive_Mutex_Test.cpp
index 71647d8dc26..e7bbef19fbf 100644
--- a/tests/Recursive_Mutex_Test.cpp
+++ b/tests/Recursive_Mutex_Test.cpp
@@ -53,7 +53,6 @@ recursive_worker (size_t nesting_level,
static void *
worker (void *arg)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
ACE_Recursive_Thread_Mutex *rm = (ACE_Recursive_Thread_Mutex *) arg;
diff --git a/tests/SOCK_Test.cpp b/tests/SOCK_Test.cpp
index 37e143fc0d3..89bffc10db0 100644
--- a/tests/SOCK_Test.cpp
+++ b/tests/SOCK_Test.cpp
@@ -32,8 +32,6 @@ static void *
client (void *arg)
{
#if (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS)
- // Insert thread into thr_mgr
- ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
#endif /* (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) */
@@ -96,8 +94,6 @@ static void *
server (void *arg)
{
#if (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS)
- // Insert thread into thr_mgr
- ACE_Thread_Control thread_control (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
#endif /* (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) */
diff --git a/tests/SPIPE_Test.cpp b/tests/SPIPE_Test.cpp
index f3896a2d6c7..57d48e9e3b8 100644
--- a/tests/SPIPE_Test.cpp
+++ b/tests/SPIPE_Test.cpp
@@ -32,14 +32,10 @@
// pipe name to use
static const char *PIPE_NAME = "ace_pipe_name";
-// Global thread manager.
-static ACE_Thread_Manager thr_mgr;
-
static void *
client (void *)
{
#if defined (ACE_WIN32)
- ACE_Thread_Control thread_control (&thr_mgr); // Insert thread into thr_mgr
ACE_NEW_THREAD;
#endif
const char *rendezvous = PIPE_NAME;
@@ -68,7 +64,6 @@ static void *
server (void *)
{
#if defined (ACE_WIN32)
- ACE_Thread_Control thread_control (&thr_mgr); // Insert thread into thr_mgr
ACE_NEW_THREAD;
#endif
ACE_SPIPE_Acceptor acceptor;
@@ -118,16 +113,17 @@ main (int, char *[])
server (0);
}
#elif defined (ACE_HAS_THREADS)
- if (thr_mgr.spawn (ACE_THR_FUNC (client),
- (void *) 0,
- THR_NEW_LWP | THR_DETACHED) == -1)
+ if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (client),
+ (void *) 0,
+ THR_NEW_LWP | THR_DETACHED) == -1)
ACE_ERROR ((LM_ERROR, "%p\n%a", "thread create failed"));
- if (thr_mgr.spawn (ACE_THR_FUNC (server),
- (void *) 0,
- THR_NEW_LWP | THR_DETACHED) == -1)
+ if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (server),
+ (void *) 0,
+ THR_NEW_LWP | THR_DETACHED) == -1)
ACE_ERROR ((LM_ERROR, "%p\n%a", "thread create failed"));
- thr_mgr.wait ();
+
+ ACE_Thread_Manager::instance ()->wait ();
#else
ACE_DEBUG ((LM_DEBUG,
"SPIPE is not supported on this platform\n"));
diff --git a/tests/Semaphore_Test.cpp b/tests/Semaphore_Test.cpp
index 17587346191..26433d1bdb0 100644
--- a/tests/Semaphore_Test.cpp
+++ b/tests/Semaphore_Test.cpp
@@ -106,7 +106,6 @@ test_timeout (void)
static void *
worker (void *)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
for (size_t iterations = 1;
diff --git a/tests/TSS_Test.cpp b/tests/TSS_Test.cpp
index 09a765e0d32..dbe669af692 100644
--- a/tests/TSS_Test.cpp
+++ b/tests/TSS_Test.cpp
@@ -61,7 +61,6 @@ cleanup (void *ptr)
static void *
worker (void *c)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
int count = int (c);
diff --git a/tests/Thread_Manager_Test.cpp b/tests/Thread_Manager_Test.cpp
index 58211f14039..8ed63df05a5 100644
--- a/tests/Thread_Manager_Test.cpp
+++ b/tests/Thread_Manager_Test.cpp
@@ -35,22 +35,17 @@ handler (int signum)
static void *
worker (int iterations)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
for (int i = 0; i < iterations; i++)
- {
- if ((i % 1000) == 0)
- {
- if (ACE_Thread_Manager::instance ()->testcancel (ACE_Thread::self ()) != 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- "(%t) has been cancelled before iteration %d!\n",
- i));
- break;
- }
- }
- }
+ if ((i % 1000) == 0
+ && ACE_Thread_Manager::instance ()->testcancel (ACE_Thread::self ()) != 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) has been cancelled before iteration %d!\n",
+ i));
+ break;
+ }
// Destructor removes thread from Thread_Manager.
return 0;
diff --git a/tests/Tokens_Test.cpp b/tests/Tokens_Test.cpp
index 691be54a620..93b3d6cf13e 100644
--- a/tests/Tokens_Test.cpp
+++ b/tests/Tokens_Test.cpp
@@ -55,7 +55,6 @@ public:
static void *
run_thread (void *vp)
{
- ACE_Thread_Control tc (ACE_Thread_Manager::instance ());
ACE_NEW_THREAD;
Test_Params *tp = (Test_Params *) vp;
ACE_Token_Collection collection (1, tp->collection_name_);