[svn-commits] dlee: branch dlee/ASTERISK-194630-startup-deadlock r398291 - /team/dlee/ASTER...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Sep 4 16:58:15 CDT 2013


Author: dlee
Date: Wed Sep  4 16:58:12 2013
New Revision: 398291

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=398291
Log:
Double initialization checking in ast_reentrancy_init()

Modified:
    team/dlee/ASTERISK-194630-startup-deadlock/include/asterisk/lock.h

Modified: team/dlee/ASTERISK-194630-startup-deadlock/include/asterisk/lock.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-194630-startup-deadlock/include/asterisk/lock.h?view=diff&rev=398291&r1=398290&r2=398291
==============================================================================
--- team/dlee/ASTERISK-194630-startup-deadlock/include/asterisk/lock.h (original)
+++ team/dlee/ASTERISK-194630-startup-deadlock/include/asterisk/lock.h Wed Sep  4 16:58:12 2013
@@ -18,7 +18,7 @@
 
 /*! \file
  * \brief Asterisk locking-related definitions:
- * - ast_mutext_t, ast_rwlock_t and related functions;
+ * - ast_mutex_t, ast_rwlock_t and related functions;
  * - atomic arithmetic instructions;
  * - wrappers for channel locking.
  *
@@ -434,25 +434,19 @@
 
 static inline void ast_reentrancy_init(struct ast_lock_track **plt)
 {
-	int i;
 	pthread_mutexattr_t reentr_attr;
 	struct ast_lock_track *lt = *plt;
 
-	if (!lt) {
-		lt = *plt = (struct ast_lock_track *) calloc(1, sizeof(*lt));
+	if (lt) {
+		fprintf(stderr, "%s: Double initialized lock tracking\n", __func__);
+#if defined(DO_CRASH) || defined(THREAD_CRASH)
+		abort();
+#else
+		return;
+#endif
 	}
 
-	for (i = 0; i < AST_MAX_REENTRANCY; i++) {
-		lt->file[i] = NULL;
-		lt->lineno[i] = 0;
-		lt->func[i] = NULL;
-		lt->thread[i] = 0;
-#ifdef HAVE_BKTR
-		memset(&lt->backtrace[i], 0, sizeof(lt->backtrace[i]));
-#endif
-	}
-
-	lt->reentrancy = 0;
+	lt = *plt = (struct ast_lock_track *) calloc(1, sizeof(*lt));
 
 	pthread_mutexattr_init(&reentr_attr);
 	pthread_mutexattr_settype(&reentr_attr, AST_MUTEX_KIND);




More information about the svn-commits mailing list