<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8075">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">channel: Add assertion to CHECK_BLOCKING.<br><br>Throw an assertion if CHECK_BLOCKING is called when blocking is already<br>enabled. The macro also returns -1 or 0 based on success but nothing<br>checks the value yet. I'd like to see if the assertions cause issues<br>for the testsuite before going further or produces FRACK logger<br>backtraces in production before moving making additional changes.<br><br>ASTERISK-27625<br><br>Change-Id: Ia6cacc9c862f2653d1b650511725e53e48e8e653<br>---<br>M include/asterisk/channel.h<br>1 file changed, 16 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/75/8075/1</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 393c020..fbf253e 100644<br>--- a/include/asterisk/channel.h<br>+++ b/include/asterisk/channel.h<br>@@ -2599,15 +2599,22 @@<br> return state;<br> }<br> <br>-#define CHECK_BLOCKING(c) do { \<br>- if (ast_test_flag(ast_channel_flags(c), AST_FLAG_BLOCKING)) {\<br>- ast_debug(1, "Thread %p is blocking '%s', already blocked by thread %p in procedure %s\n", \<br>- (void *) pthread_self(), ast_channel_name(c), (void *) ast_channel_blocker(c), ast_channel_blockproc(c)); \<br>- } else { \<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>- } } while (0)<br>+#define CHECK_BLOCKING(c) \<br>+ ({ \<br>+ int __ret = 0; \<br>+ if (ast_test_flag(ast_channel_flags(c), AST_FLAG_BLOCKING)) {\<br>+ ast_log(LOG_ERROR, "Thread %p is blocking '%s', already blocked by thread %p in procedure %s\n", \<br>+ (void *) pthread_self(), ast_channel_name(c), (void *) ast_channel_blocker(c), ast_channel_blockproc(c)); \<br>+ __ast_assert_failed(0, "The channel is already blocked by another thread.", \<br>+ __FILE__, __LINE__, __PRETTY_FUNCTION__); \<br>+ __ret = -1; \<br>+ } else { \<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>+ } \<br>+ (__ret); \<br>+ })<br> <br> ast_group_t ast_get_group(const char *s);<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8075">change 8075</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/8075"/><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: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ia6cacc9c862f2653d1b650511725e53e48e8e653 </div>
<div style="display:none"> Gerrit-Change-Number: 8075 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>