<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10293">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">lock: Reduce storage related to DEBUG_THREADS.<br><br>This reduces storage related to DEBUG_THREADS by combining tracking<br>with track in mutex / rwlock structures. The magic value (void*)-1<br>AST_LOCK_TRACK_DISABLED is used when tracking is disabled. The field<br>has been renamed from 'track' to 'tracker' to ensure outside code must<br>be updated to avoid dereferencing AST_LOCK_TRACK_DISABLED.<br><br>Change-Id: Iabd650908901843e9fff47ef1c539f0e1b8cb13b<br>---<br>M include/asterisk/lock.h<br>M main/lock.c<br>M main/utils.c<br>3 files changed, 49 insertions(+), 82 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/93/10293/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h</span><br><span>index a46d047..2bea32b 100644</span><br><span>--- a/include/asterisk/lock.h</span><br><span>+++ b/include/asterisk/lock.h</span><br><span>@@ -66,6 +66,8 @@</span><br><span> #define AST_PTHREADT_NULL (pthread_t) -1</span><br><span> #define AST_PTHREADT_STOP (pthread_t) -2</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#define AST_LOCK_TRACK_DISABLED (void*) -1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #if (defined(SOLARIS) || defined(BSD))</span><br><span> #define AST_MUTEX_INIT_W_CONSTRUCTORS</span><br><span> #endif /* SOLARIS || BSD */</span><br><span>@@ -92,11 +94,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 }</span><br><span style="color: hsl(120, 100%, 40%);">+#define AST_MUTEX_INIT_VALUE_NOTRACKING { PTHREAD_MUTEX_INIT_VALUE, AST_LOCK_TRACK_DISABLED }</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 }</span><br><span style="color: hsl(120, 100%, 40%);">+#define AST_RWLOCK_INIT_VALUE_NOTRACKING { __AST_RWLOCK_INIT_VALUE, AST_LOCK_TRACK_DISABLED }</span><br><span> </span><br><span> #define AST_MAX_REENTRANCY 10</span><br><span> </span><br><span>@@ -128,8 +130,7 @@</span><br><span> struct ast_mutex_info {</span><br><span> pthread_mutex_t mutex;</span><br><span> /*! Track which thread holds this mutex */</span><br><span style="color: hsl(0, 100%, 40%);">- 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 *tracker;</span><br><span> };</span><br><span> </span><br><span> /*! \brief Structure for rwlock and tracking information.</span><br><span>@@ -140,8 +141,7 @@</span><br><span> struct ast_rwlock_info {</span><br><span> pthread_rwlock_t lock;</span><br><span> /*! Track which thread holds this lock */</span><br><span style="color: hsl(0, 100%, 40%);">- 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 *tracker;</span><br><span> };</span><br><span> </span><br><span> typedef struct ast_mutex_info ast_mutex_t;</span><br><span>diff --git a/main/lock.c b/main/lock.c</span><br><span>index dec814f..5d632b3 100644</span><br><span>--- a/main/lock.c</span><br><span>+++ b/main/lock.c</span><br><span>@@ -77,6 +77,10 @@</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(120, 100%, 40%);">+ if (*plt == AST_LOCK_TRACK_DISABLED) {</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> /* It's a bit painful to lock a global mutex for every access to the</span><br><span> * reentrancy structure, but it's necessary to ensure that we don't</span><br><span> * double-allocate the structure or double-initialize the reentr_mutex.</span><br><span>@@ -114,11 +118,16 @@</span><br><span> return lt;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#define ast_get_tracker_existing(t) ({ \</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_lock_track *tracker = t->tracker; \</span><br><span style="color: hsl(120, 100%, 40%);">+ (tracker == AST_LOCK_TRACK_DISABLED ? NULL : tracker); \</span><br><span style="color: hsl(120, 100%, 40%);">+ })</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static inline void delete_reentrancy_cs(struct ast_lock_track **plt)</span><br><span> {</span><br><span> struct ast_lock_track *lt;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (*plt) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (*plt && *plt != AST_LOCK_TRACK_DISABLED) {</span><br><span> lt = *plt;</span><br><span> *plt = NULL;</span><br><span> </span><br><span>@@ -147,8 +156,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%);">- 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->tracker = tracking ? NULL : AST_LOCK_TRACK_DISABLED;</span><br><span> #endif /* DEBUG_THREADS */</span><br><span> </span><br><span> pthread_mutexattr_init(&attr);</span><br><span>@@ -165,8 +173,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_tracker_existing(t);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = lt && 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>@@ -230,7 +238,7 @@</span><br><span> memset(<->backtrace[0], 0, sizeof(lt->backtrace[0]));</span><br><span> #endif</span><br><span> ast_reentrancy_unlock(lt);</span><br><span style="color: hsl(0, 100%, 40%);">- delete_reentrancy_cs(&t->track);</span><br><span style="color: hsl(120, 100%, 40%);">+ delete_reentrancy_cs(&t->tracker);</span><br><span> }</span><br><span> #endif /* DEBUG_THREADS */</span><br><span> </span><br><span>@@ -243,14 +251,10 @@</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->tracker);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = lt && strcmp(filename, "logger.c");</span><br><span> struct ast_bt *bt = NULL;</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>@@ -360,14 +364,10 @@</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->tracker);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = lt && strcmp(filename, "logger.c");</span><br><span> struct ast_bt *bt = NULL;</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>@@ -420,7 +420,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->tracker != AST_LOCK_TRACK_DISABLED && strcmp(filename, "logger.c");</span><br><span> struct ast_bt *bt = NULL;</span><br><span> </span><br><span> #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)</span><br><span>@@ -432,9 +432,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(120, 100%, 40%);">+ lt = ast_get_reentrancy(&t->tracker);</span><br><span> </span><br><span> if (lt) {</span><br><span> ast_reentrancy_lock(lt);</span><br><span>@@ -543,7 +541,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->tracker != AST_LOCK_TRACK_DISABLED && 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>@@ -554,9 +552,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(120, 100%, 40%);">+ lt = ast_get_reentrancy(&t->tracker);</span><br><span> </span><br><span> if (lt) {</span><br><span> ast_reentrancy_lock(lt);</span><br><span>@@ -611,7 +607,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->tracker != AST_LOCK_TRACK_DISABLED && 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>@@ -622,9 +618,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(120, 100%, 40%);">+ lt = ast_get_reentrancy(&t->tracker);</span><br><span> </span><br><span> if (lt) {</span><br><span> ast_reentrancy_lock(lt);</span><br><span>@@ -687,8 +681,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%);">- 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->tracker = tracking ? NULL : AST_LOCK_TRACK_DISABLED;</span><br><span> #endif /* DEBUG_THREADS */</span><br><span> </span><br><span> pthread_rwlockattr_init(&attr);</span><br><span>@@ -706,8 +699,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_tracker_existing(t);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = lt && 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>@@ -741,7 +734,7 @@</span><br><span> memset(<->backtrace[0], 0, sizeof(lt->backtrace[0]));</span><br><span> #endif</span><br><span> ast_reentrancy_unlock(lt);</span><br><span style="color: hsl(0, 100%, 40%);">- delete_reentrancy_cs(&t->track);</span><br><span style="color: hsl(120, 100%, 40%);">+ delete_reentrancy_cs(&t->tracker);</span><br><span> }</span><br><span> #endif /* DEBUG_THREADS */</span><br><span> </span><br><span>@@ -754,7 +747,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->tracker != AST_LOCK_TRACK_DISABLED && strcmp(filename, "logger.c");</span><br><span> struct ast_bt *bt = NULL;</span><br><span> int lock_found = 0;</span><br><span> </span><br><span>@@ -767,9 +760,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(120, 100%, 40%);">+ lt = ast_get_reentrancy(&t->tracker);</span><br><span> </span><br><span> if (lt) {</span><br><span> ast_reentrancy_lock(lt);</span><br><span>@@ -827,14 +818,10 @@</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->tracker);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = lt && strcmp(filename, "logger.c");</span><br><span> struct ast_bt *bt = NULL;</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>@@ -929,14 +916,10 @@</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->tracker);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = lt && strcmp(filename, "logger.c");</span><br><span> struct ast_bt *bt = NULL;</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>@@ -1031,14 +1014,10 @@</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->tracker);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = lt && strcmp(filename, "logger.c");</span><br><span> struct ast_bt *bt = NULL;</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>@@ -1117,14 +1096,10 @@</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->tracker);</span><br><span style="color: hsl(120, 100%, 40%);">+ int canlog = lt && strcmp(filename, "logger.c");</span><br><span> struct ast_bt *bt = NULL;</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>@@ -1202,13 +1177,9 @@</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->tracker);</span><br><span> struct ast_bt *bt = NULL;</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>@@ -1256,13 +1227,9 @@</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->tracker);</span><br><span> struct ast_bt *bt = NULL;</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>diff --git a/main/utils.c b/main/utils.c</span><br><span>index 75f4360..108b442 100644</span><br><span>--- a/main/utils.c</span><br><span>+++ b/main/utils.c</span><br><span>@@ -1020,7 +1020,7 @@</span><br><span> return;</span><br><span> </span><br><span> lock = lock_info->locks[i].lock_addr;</span><br><span style="color: hsl(0, 100%, 40%);">- lt = lock->track;</span><br><span style="color: hsl(120, 100%, 40%);">+ lt = lock->tracker == AST_LOCK_TRACK_DISABLED ? NULL : lock->tracker;</span><br><span> ast_reentrancy_lock(lt);</span><br><span> for (j = 0; *str && j < lt->reentrancy; j++) {</span><br><span> ast_str_append(str, 0, "=== --- ---> Locked Here: %s line %d (%s)\n",</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10293">change 10293</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/10293"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Iabd650908901843e9fff47ef1c539f0e1b8cb13b </div>
<div style="display:none"> Gerrit-Change-Number: 10293 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>