<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9213">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve
Sean Bright: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">channel.c: Make CHECK_BLOCKING() save thread LWP id for messages.<br><br>* Removed an unnecessary call to ast_channel_blocker_set() in<br>__ast_read().<br><br>ASTERISK-27625<br><br>Change-Id: I342168b999984666fb869cd519fe779583a73834<br>---<br>M include/asterisk/channel.h<br>M main/channel.c<br>M main/channel_internal_api.c<br>3 files changed, 21 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h<br>index 8c171b6..d709159 100644<br>--- a/include/asterisk/channel.h<br>+++ b/include/asterisk/channel.h<br>@@ -2664,11 +2664,12 @@<br> do { \<br> if (ast_test_flag(ast_channel_flags(c), AST_FLAG_BLOCKING)) { \<br> /* This should not happen as there should only be one thread handling a channel's media at a time. */ \<br>- ast_log(LOG_DEBUG, "Thread %p is blocking '%s', already blocked by thread %p in procedure %s\n", \<br>- (void *) pthread_self(), ast_channel_name(c), \<br>- (void *) ast_channel_blocker(c), ast_channel_blockproc(c)); \<br>+ ast_log(LOG_DEBUG, "Thread LWP %d is blocking '%s', already blocked by thread LWP %d in procedure %s\n", \<br>+ ast_get_tid(), ast_channel_name(c), \<br>+ ast_channel_blocker_tid(c), ast_channel_blockproc(c)); \<br> ast_assert(0); \<br> } \<br>+ ast_channel_blocker_tid_set((c), ast_get_tid()); \<br> ast_channel_blocker_set((c), pthread_self()); \<br> ast_channel_blockproc_set((c), __PRETTY_FUNCTION__); \<br> ast_set_flag(ast_channel_flags(c), AST_FLAG_BLOCKING); \<br>@@ -4316,6 +4317,9 @@<br> pthread_t ast_channel_blocker(const struct ast_channel *chan);<br> void ast_channel_blocker_set(struct ast_channel *chan, pthread_t value);<br> <br>+int ast_channel_blocker_tid(const struct ast_channel *chan);<br>+void ast_channel_blocker_tid_set(struct ast_channel *chan, int tid);<br>+<br> ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan);<br> void ast_channel_timingfunc_set(struct ast_channel *chan, ast_timing_func_t value);<br> <br>diff --git a/main/channel.c b/main/channel.c<br>index 2a72aee..753bb1a 100644<br>--- a/main/channel.c<br>+++ b/main/channel.c<br>@@ -2735,10 +2735,10 @@<br> ast_channel_generator_set(chan, NULL);<br> <br> if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING)) {<br>- ast_log(LOG_WARNING, "Hard hangup called by thread %ld on %s, while fd "<br>- "is blocked by thread %ld in procedure %s! Expect a failure\n",<br>- (long) pthread_self(), ast_channel_name(chan), (long)ast_channel_blocker(chan), ast_channel_blockproc(chan));<br>- ast_assert(ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING) == 0);<br>+ ast_log(LOG_WARNING, "Hard hangup called by thread LWP %d on %s, while blocked by thread LWP %d in procedure %s! Expect a failure\n",<br>+ ast_get_tid(), ast_channel_name(chan), ast_channel_blocker_tid(chan),<br>+ ast_channel_blockproc(chan));<br>+ ast_assert(0);<br> }<br> <br> if (ast_channel_tech(chan)->hangup) {<br>@@ -3964,7 +3964,6 @@<br> }<br> }<br> } else {<br>- ast_channel_blocker_set(chan, pthread_self());<br> if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION)) {<br> if (ast_channel_tech(chan)->exception)<br> f = ast_channel_tech(chan)->exception(chan);<br>diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c<br>index d181f52..6e429b3 100644<br>--- a/main/channel_internal_api.c<br>+++ b/main/channel_internal_api.c<br>@@ -169,6 +169,7 @@<br> unsigned long insmpl; /*!< Track the read/written samples for monitor use */<br> unsigned long outsmpl; /*!< Track the read/written samples for monitor use */<br> <br>+ int blocker_tid; /*!< If anyone is blocking, this is their thread id */<br> int fds[AST_MAX_FDS]; /*!< File descriptors for channel -- Drivers will poll on<br> * these file descriptors, so at least one must be non -1.<br> * See \arg \ref AstFileDesc */<br>@@ -1331,6 +1332,15 @@<br> chan->blocker = value;<br> }<br> <br>+int ast_channel_blocker_tid(const struct ast_channel *chan)<br>+{<br>+ return chan->blocker_tid;<br>+}<br>+void ast_channel_blocker_tid_set(struct ast_channel *chan, int value)<br>+{<br>+ chan->blocker_tid = value;<br>+}<br>+<br> ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan)<br> {<br> return chan->timingfunc;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9213">change 9213</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9213"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I342168b999984666fb869cd519fe779583a73834 </div>
<div style="display:none"> Gerrit-Change-Number: 9213 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>