summaryrefslogtreecommitdiff
path: root/ace/Thread_Manager.cpp
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-16 07:16:12 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-16 07:16:12 +0000
commita2649fc546fcd5b75b58775873cb199f8bede3c0 (patch)
treef54570b5921d4f1f03b85197bb7da725ed1adcb2 /ace/Thread_Manager.cpp
parentd20455324b7251215cab15ad51a595f32c4ee31d (diff)
downloadATCD-a2649fc546fcd5b75b58775873cb199f8bede3c0.tar.gz
spawn_i: Fixed read uninitialized warnings on egcs with exception.
Diffstat (limited to 'ace/Thread_Manager.cpp')
-rw-r--r--ace/Thread_Manager.cpp43
1 files changed, 27 insertions, 16 deletions
diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp
index 5929e940886..86c29ef1ea3 100644
--- a/ace/Thread_Manager.cpp
+++ b/ace/Thread_Manager.cpp
@@ -6,6 +6,7 @@
#include "ace/Dynamic.h"
#include "ace/Object_Manager.h"
#include "ace/Singleton.h"
+#include "ace/Auto_Ptr.h"
#if !defined (__ACE_INLINE__)
#include "ace/Thread_Manager.i"
@@ -602,7 +603,7 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
// Create a new thread running <func>. *Must* be called with the
// <lock_> held...
#if 1
- ACE_Thread_Descriptor *new_thr_desc = this->thread_desc_freelist_.remove ();
+ auto_ptr<ACE_Thread_Descriptor> new_thr_desc = this->thread_desc_freelist_.remove ();
new_thr_desc->thr_state_ = ACE_THR_IDLE;
// Get a "new" Thread Descriptor from the freelist.
@@ -618,25 +619,31 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
-1);
#endif /* 1 */
- ACE_Thread_Adapter *thread_args =
- new ACE_Thread_Adapter (func,
- args,
-#if defined(ACE_USE_THREAD_MANAGER_ADAPTER)
- (ACE_THR_C_FUNC) ace_thread_manager_adapter,
-#else
- (ACE_THR_C_FUNC) ace_thread_adapter,
-#endif
- this,
- new_thr_desc
+ ACE_Thread_Adapter *thread_args = 0;
# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
- , ACE_LOG_MSG->seh_except_selector()
- , ACE_LOG_MSG->seh_except_handler()
+ ACE_NEW_RETURN (thread_args,
+ ACE_Thread_Adapter (func,
+ args,
+ (ACE_THR_C_FUNC) ace_thread_adapter,
+ this,
+ new_thr_desc.get (),
+ ACE_LOG_MSG->seh_except_selector(),
+ ACE_LOG_MSG->seh_except_handler()),
+ -1);
+#else
+ ACE_NEW_RETURN (thread_args,
+ ACE_Thread_Adapter (func,
+ args,
+ (ACE_THR_C_FUNC) ace_thread_adapter,
+ this,
+ new_thr_desc.get ()),
+ -1);
# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
- );
+ // @@ Memory leak if the previous new failed, need an auto pointer here.
if (thread_args == 0)
{
- delete new_thr_desc;
+ this->thr_list_.insert_head (new_thr_desc.release ());
return -1;
}
@@ -712,7 +719,7 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
grp_id,
task,
flags,
- new_thr_desc);
+ new_thr_desc.release ());
}
}
@@ -2359,6 +2366,8 @@ ACE_Thread_Control::exit (void *exit_status, int do_thr_exit)
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+ template class ACE_Auto_Basic_Ptr<ACE_Thread_Descriptor>;
+ template class auto_ptr<ACE_Thread_Descriptor>;
template class ACE_Double_Linked_List<ACE_Thread_Descriptor_Base>;
template class ACE_Double_Linked_List_Iterator_Base<ACE_Thread_Descriptor_Base>;
template class ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor_Base>;
@@ -2376,6 +2385,8 @@ ACE_Thread_Control::exit (void *exit_status, int do_thr_exit)
template class ACE_TSS<ACE_Thread_Exit>;
# endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) */
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+ #pragma instantiate ACE_Auto_Basic_Ptr<ACE_Thread_Descriptor>
+ #pragma instantiate auto_ptr<ACE_Thread_Descriptor>
#pragma instantiate ACE_Double_Linked_List<ACE_Thread_Descriptor_Base>
#pragma instantiate ACE_Double_Linked_List_Iterator_Base<ACE_Thread_Descriptor_Base>
#pragma instantiate ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor_Base>