summaryrefslogtreecommitdiff
path: root/ace/Log_Msg.cpp
diff options
context:
space:
mode:
authorbala <bala@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-08-14 19:21:03 +0000
committerbala <bala@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-08-14 19:21:03 +0000
commit8a57b40e6d2147fdae83282d0d4c6379646c3038 (patch)
tree2db3064d5307c7a4868fa09e48588720406b6a6e /ace/Log_Msg.cpp
parentcb8da92d7e6137960442702cf8b040035c2fcabd (diff)
downloadATCD-8a57b40e6d2147fdae83282d0d4c6379646c3038.tar.gz
ChangeLogTag: Tue Aug 14 14:19:37 2001 Balachandran Natarajan <bala@cs.wustl.edu>
Diffstat (limited to 'ace/Log_Msg.cpp')
-rw-r--r--ace/Log_Msg.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp
index a8ba4c18443..009d30c479b 100644
--- a/ace/Log_Msg.cpp
+++ b/ace/Log_Msg.cpp
@@ -398,6 +398,35 @@ ACE_Log_Msg::close (void)
// harded coded into the ACE_Object_Manager's shutdown sequence, in
// its destructor.
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) && \
+ (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \
+ defined (ACE_HAS_TSS_EMULATION))
+
+ if (key_created_ == 1)
+ {
+ ACE_thread_mutex_t *lock =
+ ACE_reinterpret_cast (ACE_thread_mutex_t *,
+ ACE_OS_Object_Manager::preallocated_object
+ [ACE_OS_Object_Manager::ACE_LOG_MSG_INSTANCE_LOCK]);
+ ACE_OS::thread_mutex_lock (lock);
+
+ if (key_created_ == 1)
+ {
+ // The same as the ACE_TSS_Cleanup's own key doesn't get detached,
+ // the log_msg_tss_key_ won't get detached until
+ // ACE_TSS_Cleanup::free_all_keys_left,
+ // so it will be in the ACE_TSS_Cleanup::table_.
+ // However, there's no resource associated with it, so we don't
+ // need to keyfree it. The dynamic memory associated with it
+ // was already deleted by ACE_TSS_Cleanup::exit (), so we don't
+ // want to access it again.
+ key_created_ = 0;
+ }
+
+ ACE_OS::thread_mutex_unlock (lock);
+ }
+#endif /* (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) && ACE_MT_SAFE */
+
ACE_MT (ACE_Log_Msg_Manager::close ());
}