diff options
-rw-r--r-- | ACE/ChangeLog | 10 | ||||
-rw-r--r-- | ACE/ace/Service_Config.h | 44 |
2 files changed, 35 insertions, 19 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index 608b908fca7..0f609b93870 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,13 @@ +Thu Aug 2 20:24:22 UTC 2007 Iliyan Jeliazkov <iliyan@ociweb.com> + + * ace/Service_Config.h: + + No-thread builds, instances of ACE_TSS use their destructor + instead of the static cleanup() method for deleting the object + they point to. Adding a destructor specialization to enable + non-ownership ACE_TSS behavior with no-thread builds for + ACE_Service_Gestalt's. + Thu Aug 2 19:34:17 UTC 2007 Abdullah Sowayan <abdullah.sowayan@lmco.com> * bin/fuzz.pl: diff --git a/ACE/ace/Service_Config.h b/ACE/ace/Service_Config.h index 9ec6d76d7ea..5db4d8d0746 100644 --- a/ACE/ace/Service_Config.h +++ b/ACE/ace/Service_Config.h @@ -135,32 +135,38 @@ public: #define ACE_Component_Config ACE_Service_Config -/// A prototype for the partial specialization. This specialization -/// allows us to have an ACE_TSS, which will _not_ perform a delete on -/// (ACE_Service_Gestalt*) p up on thread exit, when TSS is cleaned +/// This specialization enures ACE_TSS will _not_ perform a delete on +/// (ACE_Service_Gestalt*) p upon thread exit, when TSS is cleaned /// up. Note that the tss_ member will be destroyed with the -/// ACE_Object_Manager's ACE_Service_Config singleton, so no leaks are -/// introduced. -/// We need this because the SC instance is really owned by the -/// Object Manager and the TSS cleanup must not dispose of it -/// prematurely. Naturally, things would be simpler, if we could +/// ACE_Object_Manager's ACE_Service_Config singleton, so no leaks +/// will be introduced. +/// We need this non-ownership ACE_TSS because the SC instance is +/// really owned by the Object Manager and only it must do the cleanup. +/// +/// Naturally, things would be simpler, if we could /// avoid using the TSS altogether but we need the ability to /// temporarily designate a different SC instance as the "default." /// So, the solution is a hybrid, or non-owner ACE_TSS. See bugzila /// 2980 for a description of a test case where ACE_TSS::cleanup() is /// called before ~ACE_Object_Manager. -ACE_MT ( - // Since ACE_TSS<>::cleanup() is only defined in - // multithreaded builds ... - template<> inline void - ACE_TSS<ACE_Service_Gestalt>::cleanup (void*ptr) - { - // Borland C++ 2007 *needs* the parameter - // name, but it is not clear why ... - ACE_UNUSED_ARG (ptr); - } -) // ACE_MT +# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +// Since ACE_TSS<>::cleanup() is only defined in +// multithreaded builds ... +template<> inline void +ACE_TSS<ACE_Service_Gestalt>::cleanup (void*ptr) +{ + // Borland C++ 2007 *needs* the parameter + // name, but it is not clear why ... + ACE_UNUSED_ARG (ptr); +} +# else +template<> inline +ACE_TSS<ACE_Service_Gestalt>::~ACE_TSS (void) +{ + // Without threads, the ACE_TSS cleanup is done by ~ACE_TSS() +} +# endif /* ACE_MT_SAFE */ /** |