Github user jpeach commented on a diff in the pull request:
https://github.com/apache/trafficserver/pull/1091#discussion_r82860016
--- Diff: iocore/eventsystem/Thread.cc ---
@@ -44,7 +44,14 @@ Thread::Thread()
{
mutex = new_ProxyMutex();
MUTEX_TAKE_LOCK(mutex, (EThread *)this);
- mutex->nthread_holding = THREAD_MUTEX_THREAD_HOLDING;
+ mutex->nthread_holding += THREAD_MUTEX_THREAD_HOLDING;
+}
+
+Thread::~Thread()
+{
+ ink_release_assert(mutex->thread_holding == (EThread *)this);
+ mutex->nthread_holding -= THREAD_MUTEX_THREAD_HOLDING;
+ MUTEX_UNTAKE_LOCK(mutex, (EThread *)this);
--- End diff --
There is a TSAPI test that creates and destroys threads. Since we now
verify the result of ``pthread_mutex_destroy``, the additional
``n_thread_holding`` refcount causes us to try to destroy the mutex while it is
still locked. We have to drop our bogus refcount to cause the unlock to take
effect.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---