diff options
Diffstat (limited to 'ace/TSS_T.cpp')
-rw-r--r-- | ace/TSS_T.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/ace/TSS_T.cpp b/ace/TSS_T.cpp index ac474228bda..fc25332dd1f 100644 --- a/ace/TSS_T.cpp +++ b/ace/TSS_T.cpp @@ -29,10 +29,15 @@ ACE_ALLOC_HOOK_DEFINE(ACE_TSS) template <class TYPE> ACE_TSS<TYPE>::~ACE_TSS (void) { - // We can't call <ACE_OS::thr_keyfree> until *all* of the threads - // that are using that key have done an <ACE_OS::thr_key_detach>. - // Otherwise, we'll end up with "dangling TSS pointers." - ACE_OS::thr_key_detach (this); +#if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) + if (this->once_ != 0) + { + ACE_OS::thr_key_detach (this->key_, this); + } +#else // defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) + // We own it, we need to delete it. + delete type_; +#endif // defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) } template <class TYPE> TYPE * |