summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2012-11-06 14:48:54 +0000
committerSteve Huston <shuston@riverace.com>2012-11-06 14:48:54 +0000
commit90413f0bae55bb92257c93fd5599c621141b3305 (patch)
tree948186a587048728029d85c13b91bbb1dfc023e6
parent3b0c2403bd56a9f2abfe0f93912c38f1cfe0e6ec (diff)
downloadATCD-90413f0bae55bb92257c93fd5599c621141b3305.tar.gz
Tue Nov 6 14:44:38 UTC 2012 Steve Huston <shuston@riverace.com>
* ace/OS_NS_Thread.cpp (ACE_TSS_Cleanup::thread_detach_key): If given a key which was never set, ignore it. Only throw an assertion if the key's table slot is used but does not match the key asked to free. The never-set case happens if a ACE_TSS object fails when setting its value; the later cleanup would cause an assert.
-rw-r--r--ChangeLog8
-rw-r--r--ace/OS_NS_Thread.cpp8
2 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 14d5e0d9f5f..8077ce6cce9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue Nov 6 14:44:38 UTC 2012 Steve Huston <shuston@riverace.com>
+
+ * ace/OS_NS_Thread.cpp (ACE_TSS_Cleanup::thread_detach_key): If
+ given a key which was never set, ignore it. Only throw an assertion
+ if the key's table slot is used but does not match the key asked
+ to free. The never-set case happens if a ACE_TSS object fails
+ when setting its value; the later cleanup would cause an assert.
+
Thu Sep 13 16:46:03 UTC 2012 Steve Huston <shuston@riverace.com>
* ace/Atomic_Op.h:
diff --git a/ace/OS_NS_Thread.cpp b/ace/OS_NS_Thread.cpp
index 7380b84e522..8af5ae1d69d 100644
--- a/ace/OS_NS_Thread.cpp
+++ b/ace/OS_NS_Thread.cpp
@@ -901,8 +901,12 @@ ACE_TSS_Cleanup::thread_detach_key (ACE_thread_key_t key)
ACE_TSS_CLEANUP_GUARD
u_int key_index = key;
- ACE_ASSERT (key_index < sizeof(this->table_)/sizeof(this->table_[0])
- && this->table_[key_index].key_ == key);
+ ACE_ASSERT (key_index < sizeof(this->table_)/sizeof(this->table_[0]));
+ // If this entry was never set, just bug out. If it is set, but is the
+ // wrong key, assert.
+ if (this->table_[key_index].key_ == 0)
+ return 0;
+ ACE_ASSERT (this->table_[key_index].key_ == key);
ACE_TSS_Info &info = this->table_ [key_index];
// sanity check