diff options
author | wilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-08-13 21:03:24 +0000 |
---|---|---|
committer | wilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-08-13 21:03:24 +0000 |
commit | 9a472d32c26015dcbc7afef45cd1e05e6b1ad3fc (patch) | |
tree | 3f53cc6075ea3388db27c580dc287db9d0fd83d0 /ace/Object_Manager.cpp | |
parent | 742f72bd561d26957f35f42e5d216b022ba75c27 (diff) | |
download | ATCD-9a472d32c26015dcbc7afef45cd1e05e6b1ad3fc.tar.gz |
ChangeLogTag: Fri Aug 13 15:26:40 2004 Dale Wilson <wilson_d@ociweb.com>
Diffstat (limited to 'ace/Object_Manager.cpp')
-rw-r--r-- | ace/Object_Manager.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/ace/Object_Manager.cpp b/ace/Object_Manager.cpp index a1dcfdb729b..551e390bf7c 100644 --- a/ace/Object_Manager.cpp +++ b/ace/Object_Manager.cpp @@ -16,6 +16,7 @@ #include "ace/Signal.h" #include "ace/Framework_Component.h" #include "ace/Atomic_Op.h" +#include "ace/OS_NS_sys_time.h" #if !defined (__ACE_INLINE__) # include "ace/Object_Manager.inl" @@ -603,7 +604,30 @@ ACE_Object_Manager::fini (void) // No mutex here. Only the main thread should destroy the singleton // ACE_Object_Manager instance. - // First, indicate that this ACE_Object_Manager instance is being + //////////////////////////////////////////////////////////////////////// + // Before setting the "shutting down" state, give any lingering threads + // a chance to exit. + ACE_Time_Value tv ( ACE_OS::gettimeofday ()); + tv += ACE_Time_Value(1, 0); // add one second + if ( ACE_Thread_Manager::instance()->wait(&tv) != 0) + { + // A couple of bad things can result if this wait times out. + // The least serious is resouce leaks. Fortunately end-of-process which + // is going to happen real soon now will clean up most of these. + // A more serious problem is the lingering threads could attempt to use + // the ACE infrastructure that we're just about to dismantle -- leading + // to program crashes at exit time. + // If this is unacceptable, we could add an option to the Object Manager + // to force it to wait here. There may be applications for which a hang + // is better than a silent resource leak. +#if 0 + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) ACE_Object_Manager::fini wait for threads timed out.\n") + )); +#endif + } + + // Indicate that this ACE_Object_Manager instance is being // shut down. object_manager_state_ = OBJ_MAN_SHUTTING_DOWN; |