<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/10317">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Joshua Colp: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">lock: Improve performance of DEBUG_THREADS.<br><br>Add a volatile flag to lock tracking structures so we only need to use<br>the global lock when first initializing tracking.<br><br>Additionally add support for DEBUG_THREADS_LOOSE_ABI. This is used by<br>astobj2.c to eliminate storage for tracking fields when DEBUG_THREADS is<br>not defined.<br><br>Change-Id: Iabd650908901843e9fff47ef1c539f0e1b8cb13b<br>---<br>M include/asterisk/astobj2.h<br>M include/asterisk/lock.h<br>M main/astobj2.c<br>M main/lock.c<br>4 files changed, 81 insertions(+), 90 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/asterisk/astobj2.h b/include/asterisk/astobj2.h</span><br><span>index 0e442db..8e3a105 100644</span><br><span>--- a/include/asterisk/astobj2.h</span><br><span>+++ b/include/asterisk/astobj2.h</span><br><span>@@ -752,6 +752,9 @@</span><br><span> * lock address, this allows you to correlate against</span><br><span> * object address, to match objects to reported locks.</span><br><span> *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \warning AO2 lock objects do not include tracking fields when</span><br><span style="color: hsl(120, 100%, 40%);">+ * DEBUG_THREADS is not enabled.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span> * \since 1.6.1</span><br><span> */</span><br><span> void *ao2_object_get_lockaddr(void *obj);</span><br><span>diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h</span><br><span>index 5b6817f..28091f9 100644</span><br><span>--- a/include/asterisk/lock.h</span><br><span>+++ b/include/asterisk/lock.h</span><br><span>@@ -92,11 +92,11 @@</span><br><span> #define AST_LOCK_TRACK_INIT_VALUE { { NULL }, { 0 }, 0, { NULL }, { 0 }, PTHREAD_MUTEX_INIT_VALUE }</span><br><span> #endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#define AST_MUTEX_INIT_VALUE { PTHREAD_MUTEX_INIT_VALUE, NULL, 1 }</span><br><span style="color: hsl(0, 100%, 40%);">-#define AST_MUTEX_INIT_VALUE_NOTRACKING { PTHREAD_MUTEX_INIT_VALUE, NULL, 0 }</span><br><span style="color: hsl(120, 100%, 40%);">+#define AST_MUTEX_INIT_VALUE { PTHREAD_MUTEX_INIT_VALUE, NULL, {1, 0} }</span><br><span style="color: hsl(120, 100%, 40%);">+#define AST_MUTEX_INIT_VALUE_NOTRACKING { PTHREAD_MUTEX_INIT_VALUE, NULL, {0, 0} }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#define AST_RWLOCK_INIT_VALUE { __AST_RWLOCK_INIT_VALUE, NULL, 1 }</span><br><span style="color: hsl(0, 100%, 40%);">-#define AST_RWLOCK_INIT_VALUE_NOTRACKING { __AST_RWLOCK_INIT_VALUE, NULL, 0 }</span><br><span style="color: hsl(120, 100%, 40%);">+#define AST_RWLOCK_INIT_VALUE { __AST_RWLOCK_INIT_VALUE, NULL, {1, 0} }</span><br><span style="color: hsl(120, 100%, 40%);">+#define AST_RWLOCK_INIT_VALUE_NOTRACKING { __AST_RWLOCK_INIT_VALUE, NULL, {0, 0} }</span><br><span> </span><br><span> #define AST_MAX_REENTRANCY 10</span><br><span> </span><br><span>@@ -120,6 +120,13 @@</span><br><span> pthread_mutex_t reentr_mutex;</span><br><span> };</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+struct ast_lock_track_flags {</span><br><span style="color: hsl(120, 100%, 40%);">+ /*! non-zero if lock tracking is enabled */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int tracking:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ /*! non-zero if track is setup */</span><br><span style="color: hsl(120, 100%, 40%);">+ volatile unsigned int setup:1;</span><br><span style="color: hsl(120, 100%, 40%);">+};</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! \brief Structure for mutex and tracking information.</span><br><span> *</span><br><span> * We have tracking information in this structure regardless of DEBUG_THREADS being enabled.</span><br><span>@@ -127,9 +134,18 @@</span><br><span> */</span><br><span> struct ast_mutex_info {</span><br><span> pthread_mutex_t mutex;</span><br><span style="color: hsl(0, 100%, 40%);">- /*! Track which thread holds this mutex */</span><br><span style="color: hsl(120, 100%, 40%);">+#if !defined(DEBUG_THREADS) && !defined(DEBUG_THREADS_LOOSE_ABI)</span><br><span style="color: hsl(120, 100%, 40%);">+ /*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * These fields are renamed to ensure they are never used when</span><br><span style="color: hsl(120, 100%, 40%);">+ * DEBUG_THREADS is not defined.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track *_track;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track_flags _flags;</span><br><span style="color: hsl(120, 100%, 40%);">+#elif defined(DEBUG_THREADS)</span><br><span style="color: hsl(120, 100%, 40%);">+ /*! Track which thread holds this mutex. */</span><br><span> struct ast_lock_track *track;</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int tracking:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track_flags flags;</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> };</span><br><span> </span><br><span> /*! \brief Structure for rwlock and tracking information.</span><br><span>@@ -139,9 +155,18 @@</span><br><span> */</span><br><span> struct ast_rwlock_info {</span><br><span> pthread_rwlock_t lock;</span><br><span style="color: hsl(120, 100%, 40%);">+#if !defined(DEBUG_THREADS) && !defined(DEBUG_THREADS_LOOSE_ABI)</span><br><span style="color: hsl(120, 100%, 40%);">+ /*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * These fields are renamed to ensure they are never used when</span><br><span style="color: hsl(120, 100%, 40%);">+ * DEBUG_THREADS is not defined.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track *_track;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track_flags _flags;</span><br><span style="color: hsl(120, 100%, 40%);">+#elif defined(DEBUG_THREADS)</span><br><span> /*! Track which thread holds this lock */</span><br><span> struct ast_lock_track *track;</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int tracking:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track_flags flags;</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> };</span><br><span> </span><br><span> typedef struct ast_mutex_info ast_mutex_t;</span><br><span>diff --git a/main/astobj2.c b/main/astobj2.c</span><br><span>index 91ebc1e..d9d8a0c 100644</span><br><span>--- a/main/astobj2.c</span><br><span>+++ b/main/astobj2.c</span><br><span>@@ -25,6 +25,10 @@</span><br><span> <support_level>core</support_level></span><br><span> ***/</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* This reduces the size of lock structures within astobj2 objects when</span><br><span style="color: hsl(120, 100%, 40%);">+ * DEBUG_THREADS is not defined. */</span><br><span style="color: hsl(120, 100%, 40%);">+#define DEBUG_THREADS_LOOSE_ABI</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #include "asterisk.h"</span><br><span> </span><br><span> #include "asterisk/_private.h"</span><br><span>diff --git a/main/lock.c b/main/lock.c</span><br><span>index 9c1d383..77ca0ea 100644</span><br><span>--- a/main/lock.c</span><br><span>+++ b/main/lock.c</span><br><span>@@ -72,21 +72,16 @@</span><br><span> #ifdef DEBUG_THREADS</span><br><span> AST_MUTEX_DEFINE_STATIC(reentrancy_lock);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static inline struct ast_lock_track *ast_get_reentrancy(struct ast_lock_track **plt)</span><br><span style="color: hsl(120, 100%, 40%);">+static inline struct ast_lock_track *ast_get_reentrancy(struct ast_lock_track **plt,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track_flags *flags, int no_setup)</span><br><span> {</span><br><span> pthread_mutexattr_t reentr_attr;</span><br><span> struct ast_lock_track *lt;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- /* It's a bit painful to lock a global mutex for every access to the</span><br><span style="color: hsl(0, 100%, 40%);">- * reentrancy structure, but it's necessary to ensure that we don't</span><br><span style="color: hsl(0, 100%, 40%);">- * double-allocate the structure or double-initialize the reentr_mutex.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * If you'd like to replace this with a double-checked lock, be sure to</span><br><span style="color: hsl(0, 100%, 40%);">- * properly volatile-ize everything to avoid optimizer bugs.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * We also have to use the underlying pthread calls for manipulating</span><br><span style="color: hsl(0, 100%, 40%);">- * the mutex, because this is called from the Asterisk mutex code.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!flags->tracking || flags->setup) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return *plt;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> pthread_mutex_lock(&reentrancy_lock.mutex);</span><br><span> </span><br><span> if (*plt) {</span><br><span>@@ -94,6 +89,11 @@</span><br><span> return *plt;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (no_setup) {</span><br><span style="color: hsl(120, 100%, 40%);">+ pthread_mutex_unlock(&reentrancy_lock.mutex);</span><br><span style="color: hsl(120, 100%, 40%);">+ return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> lt = *plt = ast_std_calloc(1, sizeof(*lt));</span><br><span> if (!lt) {</span><br><span> fprintf(stderr, "%s: Failed to allocate lock tracking\n", __func__);</span><br><span>@@ -110,6 +110,7 @@</span><br><span> pthread_mutex_init(<->reentr_mutex, &reentr_attr);</span><br><span> pthread_mutexattr_destroy(&reentr_attr);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ flags->setup = 1;</span><br><span> pthread_mutex_unlock(&reentrancy_lock.mutex);</span><br><span> return lt;</span><br><span> }</span><br><span>@@ -148,7 +149,8 @@</span><br><span> #endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */</span><br><span> </span><br><span> t->track = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- t->tracking = tracking;</span><br><span style="color: hsl(120, 100%, 40%);">+ t->flags.tracking = tracking;</span><br><span style="color: hsl(120, 100%, 40%);">+ t->flags.setup = 0;</span><br><span> #endif /* DEBUG_THREADS */</span><br><span> </span><br><span> pthread_mutexattr_init(&attr);</span><br><span>@@ -165,8 +167,8 @@</span><br><span> int res;</span><br><span> </span><br><span> #ifdef DEBUG_THREADS</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_lock_track *lt = t->track;</span><br><span style="color: hsl(0, 100%, 40%);">- int canlog = t->tracking && strcmp(filename, "logger.c");</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = t->flags.tracking && strcmp(filename, "logger.c");</span><br><span> </span><br><span> #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)</span><br><span> if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {</span><br><span>@@ -243,16 +245,12 @@</span><br><span> int res;</span><br><span> </span><br><span> #ifdef DEBUG_THREADS</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_lock_track *lt = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- int canlog = t->tracking && strcmp(filename, "logger.c");</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = t->flags.tracking && strcmp(filename, "logger.c");</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt *bt = NULL;</span><br><span> #endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (t->tracking) {</span><br><span style="color: hsl(0, 100%, 40%);">- lt = ast_get_reentrancy(&t->track);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> if (lt) {</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt tmp;</span><br><span>@@ -367,16 +365,12 @@</span><br><span> int res;</span><br><span> </span><br><span> #ifdef DEBUG_THREADS</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_lock_track *lt = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- int canlog = t->tracking && strcmp(filename, "logger.c");</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = t->flags.tracking && strcmp(filename, "logger.c");</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt *bt = NULL;</span><br><span> #endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (t->tracking) {</span><br><span style="color: hsl(0, 100%, 40%);">- lt = ast_get_reentrancy(&t->track);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> if (lt) {</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt tmp;</span><br><span>@@ -432,7 +426,7 @@</span><br><span> </span><br><span> #ifdef DEBUG_THREADS</span><br><span> struct ast_lock_track *lt = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- int canlog = t->tracking && strcmp(filename, "logger.c");</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = t->flags.tracking && strcmp(filename, "logger.c");</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt *bt = NULL;</span><br><span> #endif</span><br><span>@@ -446,10 +440,7 @@</span><br><span> }</span><br><span> #endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (t->tracking) {</span><br><span style="color: hsl(0, 100%, 40%);">- lt = ast_get_reentrancy(&t->track);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+ lt = ast_get_reentrancy(&t->track, &t->flags, 0);</span><br><span> if (lt) {</span><br><span> ast_reentrancy_lock(lt);</span><br><span> if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {</span><br><span>@@ -561,7 +552,7 @@</span><br><span> #ifdef DEBUG_THREADS</span><br><span> struct ast_lock_track *lt = NULL;</span><br><span> struct ast_lock_track lt_orig;</span><br><span style="color: hsl(0, 100%, 40%);">- int canlog = t->tracking && strcmp(filename, "logger.c");</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = t->flags.tracking && strcmp(filename, "logger.c");</span><br><span> </span><br><span> #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)</span><br><span> if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {</span><br><span>@@ -572,10 +563,7 @@</span><br><span> }</span><br><span> #endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (t->tracking) {</span><br><span style="color: hsl(0, 100%, 40%);">- lt = ast_get_reentrancy(&t->track);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+ lt = ast_get_reentrancy(&t->track, &t->flags, 0);</span><br><span> if (lt) {</span><br><span> ast_reentrancy_lock(lt);</span><br><span> if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {</span><br><span>@@ -629,7 +617,7 @@</span><br><span> #ifdef DEBUG_THREADS</span><br><span> struct ast_lock_track *lt = NULL;</span><br><span> struct ast_lock_track lt_orig;</span><br><span style="color: hsl(0, 100%, 40%);">- int canlog = t->tracking && strcmp(filename, "logger.c");</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = t->flags.tracking && strcmp(filename, "logger.c");</span><br><span> </span><br><span> #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)</span><br><span> if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {</span><br><span>@@ -640,10 +628,7 @@</span><br><span> }</span><br><span> #endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (t->tracking) {</span><br><span style="color: hsl(0, 100%, 40%);">- lt = ast_get_reentrancy(&t->track);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+ lt = ast_get_reentrancy(&t->track, &t->flags, 0);</span><br><span> if (lt) {</span><br><span> ast_reentrancy_lock(lt);</span><br><span> if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {</span><br><span>@@ -706,7 +691,8 @@</span><br><span> #endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */</span><br><span> </span><br><span> t->track = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- t->tracking = tracking;</span><br><span style="color: hsl(120, 100%, 40%);">+ t->flags.tracking = tracking;</span><br><span style="color: hsl(120, 100%, 40%);">+ t->flags.setup = 0;</span><br><span> #endif /* DEBUG_THREADS */</span><br><span> </span><br><span> pthread_rwlockattr_init(&attr);</span><br><span>@@ -724,8 +710,8 @@</span><br><span> int res;</span><br><span> </span><br><span> #ifdef DEBUG_THREADS</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_lock_track *lt = t->track;</span><br><span style="color: hsl(0, 100%, 40%);">- int canlog = t->tracking && strcmp(filename, "logger.c");</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = t->flags.tracking && strcmp(filename, "logger.c");</span><br><span> </span><br><span> #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)</span><br><span> if (t->lock == ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {</span><br><span>@@ -772,7 +758,7 @@</span><br><span> </span><br><span> #ifdef DEBUG_THREADS</span><br><span> struct ast_lock_track *lt = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- int canlog = t->tracking && strcmp(filename, "logger.c");</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = t->flags.tracking && strcmp(filename, "logger.c");</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt *bt = NULL;</span><br><span> #endif</span><br><span>@@ -787,10 +773,7 @@</span><br><span> }</span><br><span> #endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (t->tracking) {</span><br><span style="color: hsl(0, 100%, 40%);">- lt = ast_get_reentrancy(&t->track);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+ lt = ast_get_reentrancy(&t->track, &t->flags, 0);</span><br><span> if (lt) {</span><br><span> ast_reentrancy_lock(lt);</span><br><span> if (lt->reentrancy) {</span><br><span>@@ -851,16 +834,12 @@</span><br><span> int res;</span><br><span> </span><br><span> #ifdef DEBUG_THREADS</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_lock_track *lt = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- int canlog = t->tracking && strcmp(filename, "logger.c");</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = t->flags.tracking && strcmp(filename, "logger.c");</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt *bt = NULL;</span><br><span> #endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (t->tracking) {</span><br><span style="color: hsl(0, 100%, 40%);">- lt = ast_get_reentrancy(&t->track);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> if (lt) {</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt tmp;</span><br><span>@@ -960,16 +939,12 @@</span><br><span> int res;</span><br><span> </span><br><span> #ifdef DEBUG_THREADS</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_lock_track *lt = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- int canlog = t->tracking && strcmp(filename, "logger.c");</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = t->flags.tracking && strcmp(filename, "logger.c");</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt *bt = NULL;</span><br><span> #endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (t->tracking) {</span><br><span style="color: hsl(0, 100%, 40%);">- lt = ast_get_reentrancy(&t->track);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> if (lt) {</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt tmp;</span><br><span>@@ -1069,16 +1044,12 @@</span><br><span> int res;</span><br><span> </span><br><span> #ifdef DEBUG_THREADS</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_lock_track *lt = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- int canlog = t->tracking && strcmp(filename, "logger.c");</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = t->flags.tracking && strcmp(filename, "logger.c");</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt *bt = NULL;</span><br><span> #endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (t->tracking) {</span><br><span style="color: hsl(0, 100%, 40%);">- lt = ast_get_reentrancy(&t->track);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> if (lt) {</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt tmp;</span><br><span>@@ -1162,16 +1133,12 @@</span><br><span> int res;</span><br><span> </span><br><span> #ifdef DEBUG_THREADS</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_lock_track *lt = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- int canlog = t->tracking && strcmp(filename, "logger.c");</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = t->flags.tracking && strcmp(filename, "logger.c");</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt *bt = NULL;</span><br><span> #endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (t->tracking) {</span><br><span style="color: hsl(0, 100%, 40%);">- lt = ast_get_reentrancy(&t->track);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> if (lt) {</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt tmp;</span><br><span>@@ -1254,15 +1221,11 @@</span><br><span> int res;</span><br><span> </span><br><span> #ifdef DEBUG_THREADS</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_lock_track *lt = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt *bt = NULL;</span><br><span> #endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (t->tracking) {</span><br><span style="color: hsl(0, 100%, 40%);">- lt = ast_get_reentrancy(&t->track);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> if (lt) {</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt tmp;</span><br><span>@@ -1313,15 +1276,11 @@</span><br><span> int res;</span><br><span> </span><br><span> #ifdef DEBUG_THREADS</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_lock_track *lt = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt *bt = NULL;</span><br><span> #endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (t->tracking) {</span><br><span style="color: hsl(0, 100%, 40%);">- lt = ast_get_reentrancy(&t->track);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> if (lt) {</span><br><span> #ifdef HAVE_BKTR</span><br><span> struct ast_bt tmp;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10317">change 10317</a>. To unsubscribe, or for help writing mail filters, 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/10317"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Iabd650908901843e9fff47ef1c539f0e1b8cb13b </div>
<div style="display:none"> Gerrit-Change-Number: 10317 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>