diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-08-28 15:43:23 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-08-28 15:43:23 +0000 |
commit | 936451d6556793bb513cfc77f28a4b67de693eaa (patch) | |
tree | 9f7364f937e5dc1fe649ab8a462056a4cb5e5689 /ace/Task.cpp | |
parent | a88f96de21dcc98914fe4ef30fd9902eb602d416 (diff) | |
download | ATCD-936451d6556793bb513cfc77f28a4b67de693eaa.tar.gz |
(ACE_Task_Exit::instance) added call to ACE_Object_Manager::at_exit () to clean up the singleton at program termination
Diffstat (limited to 'ace/Task.cpp')
-rw-r--r-- | ace/Task.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ace/Task.cpp b/ace/Task.cpp index e9c3180ecbe..5ecd6db209b 100644 --- a/ace/Task.cpp +++ b/ace/Task.cpp @@ -5,6 +5,7 @@ #include "ace/Task.h" #include "ace/Module.h" #include "ace/Service_Config.h" +#include "ace/Object_Manager.h" #if !defined (__ACE_INLINE__) #include "ace/Task.i" @@ -23,6 +24,24 @@ ACE_Thread_Mutex ACE_Task_Exit::ace_task_lock_; #endif /* defined (ACE_MT_SAFE) */ +#if defined (ACE_HAS_SIG_C_FUNC) +extern "C" void +ACE_Task_Exit_cleanup (void *instance, void *) +{ + ACE_TRACE ("ACE_Task_Exit::cleanup"); + + delete (ACE_TSS_TYPE (ACE_Task_Exit) *) instance; +} +#else +void +ACE_Task_Exit::cleanup (void *instance, void *) +{ + ACE_TRACE ("ACE_Task_Exit::cleanup"); + + delete (ACE_TSS_TYPE (ACE_Task_Exit) *) instance; +} +#endif /* ACE_HAS_SIG_C_FUNC */ + // NOTE: this preprocessor directive should match the one in // ACE_Task_Base::svc_run () below. This prevents the two statics // from being defined. @@ -43,6 +62,13 @@ ACE_Task_Exit::instance (void) if (instance_ == 0) ACE_NEW_RETURN (instance_, ACE_TSS_TYPE (ACE_Task_Exit), 0); + + // Register for destruction with ACE_Object_Manager. +#if defined ACE_HAS_SIG_C_FUNC + ACE_Object_Manager::at_exit (instance_, ACE_Task_Exit_cleanup, 0); +#else + ACE_Object_Manager::at_exit (instance_, ACE_Task_Exit::cleanup, 0); +#endif /* ACE_HAS_SIG_C_FUNC */ } return ACE_TSS_GET (instance_, ACE_Task_Exit); |