[asterisk-commits] dlee: branch dlee/ASTERISK-194630-startup-deadlock r398497 - in /team/dlee/AS...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 5 16:24:01 CDT 2013


Author: dlee
Date: Thu Sep  5 16:24:00 2013
New Revision: 398497

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=398497
Log:
Wrong branch

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

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=398497&r1=398496&r2=398497
==============================================================================
--- team/dlee/ASTERISK-194630-startup-deadlock/include/asterisk/lock.h (original)
+++ team/dlee/ASTERISK-194630-startup-deadlock/include/asterisk/lock.h Thu Sep  5 16:24:00 2013
@@ -281,16 +281,12 @@
 #else
 void ast_remove_lock_info(void *lock_addr);
 #endif /* HAVE_BKTR */
-void ast_suspend_lock_info(void *lock_addr);
-void ast_restore_lock_info(void *lock_addr);
 #else
 #ifdef HAVE_BKTR
 #define ast_remove_lock_info(ignore,me)
 #else
 #define ast_remove_lock_info(ignore)
 #endif /* HAVE_BKTR */
-#define ast_suspend_lock_info(ignore);
-#define ast_restore_lock_info(ignore);
 #endif /* !defined(LOW_MEMORY) */
 
 /*!

Modified: team/dlee/ASTERISK-194630-startup-deadlock/main/lock.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-194630-startup-deadlock/main/lock.c?view=diff&rev=398497&r1=398496&r2=398497
==============================================================================
--- team/dlee/ASTERISK-194630-startup-deadlock/main/lock.c (original)
+++ team/dlee/ASTERISK-194630-startup-deadlock/main/lock.c Thu Sep  5 16:24:00 2013
@@ -603,7 +603,11 @@
 #endif
 		ast_reentrancy_unlock(lt);
 
-		ast_suspend_lock_info(t);
+#ifdef HAVE_BKTR
+		ast_remove_lock_info(t, bt);
+#else
+		ast_remove_lock_info(t);
+#endif
 	}
 #endif /* DEBUG_THREADS */
 
@@ -632,7 +636,11 @@
 		}
 		ast_reentrancy_unlock(lt);
 
-		ast_restore_lock_info(t);
+#ifdef HAVE_BKTR
+		ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt);
+#else
+		ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t);
+#endif
 	}
 #endif /* DEBUG_THREADS */
 
@@ -701,7 +709,11 @@
 #endif
 		ast_reentrancy_unlock(lt);
 
-		ast_suspend_lock_info(t);
+#ifdef HAVE_BKTR
+		ast_remove_lock_info(t, bt);
+#else
+		ast_remove_lock_info(t);
+#endif
 	}
 #endif /* DEBUG_THREADS */
 
@@ -730,7 +742,11 @@
 		}
 		ast_reentrancy_unlock(lt);
 
-		ast_suspend_lock_info(t);
+#ifdef HAVE_BKTR
+		ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt);
+#else
+		ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t);
+#endif
 	}
 #endif /* DEBUG_THREADS */
 

Modified: team/dlee/ASTERISK-194630-startup-deadlock/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-194630-startup-deadlock/main/utils.c?view=diff&rev=398497&r1=398496&r2=398497
==============================================================================
--- team/dlee/ASTERISK-194630-startup-deadlock/main/utils.c (original)
+++ team/dlee/ASTERISK-194630-startup-deadlock/main/utils.c Thu Sep  5 16:24:00 2013
@@ -585,8 +585,6 @@
 		enum ast_lock_type type;
 		/*! This thread is waiting on this lock */
 		int pending:2;
-		/*! A condition as suspended this lock */
-		int suspended:1;
 #ifdef HAVE_BKTR
 		struct ast_bt *backtrace;
 #endif
@@ -773,60 +771,6 @@
 	return 0;
 }
 
-void ast_suspend_lock_info(void *lock_addr)
-{
-	struct thr_lock_info *lock_info;
-	int i = 0;
-
-	if (!(lock_info = ast_threadstorage_get(&thread_lock_info, sizeof(*lock_info)))) {
-		return;
-	}
-
-	pthread_mutex_lock(&lock_info->lock);
-
-	for (i = lock_info->num_locks - 1; i >= 0; i--) {
-		if (lock_info->locks[i].lock_addr == lock_addr)
-			break;
-	}
-
-	if (i == -1) {
-		/* Lock not found :( */
-		pthread_mutex_unlock(&lock_info->lock);
-		return;
-	}
-
-	lock_info->locks[i].suspended = 1;
-
-	pthread_mutex_unlock(&lock_info->lock);
-}
-
-void ast_restore_lock_info(void *lock_addr)
-{
-	struct thr_lock_info *lock_info;
-	int i = 0;
-
-	if (!(lock_info = ast_threadstorage_get(&thread_lock_info, sizeof(*lock_info))))
-		return;
-
-	pthread_mutex_lock(&lock_info->lock);
-
-	for (i = lock_info->num_locks - 1; i >= 0; i--) {
-		if (lock_info->locks[i].lock_addr == lock_addr)
-			break;
-	}
-
-	if (i == -1) {
-		/* Lock not found :( */
-		pthread_mutex_unlock(&lock_info->lock);
-		return;
-	}
-
-	lock_info->locks[i].suspended = 0;
-
-	pthread_mutex_unlock(&lock_info->lock);
-}
-
-
 #ifdef HAVE_BKTR
 void ast_remove_lock_info(void *lock_addr, struct ast_bt *bt)
 #else
@@ -920,7 +864,7 @@
 	ast_mutex_t *lock;
 	struct ast_lock_track *lt;
 	
-	ast_str_append(str, 0, "=== ---> %sLock #%d (%s): %s %d %s %s %p (%d%s)\n", 
+	ast_str_append(str, 0, "=== ---> %sLock #%d (%s): %s %d %s %s %p (%d)\n", 
 				   lock_info->locks[i].pending > 0 ? "Waiting for " : 
 				   lock_info->locks[i].pending < 0 ? "Tried and failed to get " : "", i,
 				   lock_info->locks[i].file, 
@@ -928,8 +872,7 @@
 				   lock_info->locks[i].line_num,
 				   lock_info->locks[i].func, lock_info->locks[i].lock_name,
 				   lock_info->locks[i].lock_addr, 
-				   lock_info->locks[i].times_locked,
-				   lock_info->locks[i].suspended ? " - suspended" : "");
+				   lock_info->locks[i].times_locked);
 #ifdef HAVE_BKTR
 	append_backtrace_information(str, lock_info->locks[i].backtrace);
 #endif
@@ -1038,32 +981,20 @@
 	pthread_mutex_lock(&lock_infos_lock.mutex);
 	AST_LIST_TRAVERSE(&lock_infos, lock_info, entry) {
 		int i;
-		int header_printed = 0;
-		pthread_mutex_lock(&lock_info->lock);
-		for (i = 0; str && i < lock_info->num_locks; i++) {
-			/* Don't show suspended locks */
-			if (lock_info->locks[i].suspended) {
-				continue;
+		if (lock_info->num_locks) {
+			ast_str_append(&str, 0, "=== Thread ID: 0x%lx (%s)\n", (long) lock_info->thread_id,
+				lock_info->thread_name);
+			pthread_mutex_lock(&lock_info->lock);
+			for (i = 0; str && i < lock_info->num_locks; i++) {
+				append_lock_information(&str, lock_info, i);
 			}
-
-			if (!header_printed) {
-				ast_str_append(&str, 0, "=== Thread ID: 0x%lx (%s)\n", (long) lock_info->thread_id,
-					lock_info->thread_name);
-				header_printed = 1;
-			}
-
-			append_lock_information(&str, lock_info, i);
-		}
-		pthread_mutex_unlock(&lock_info->lock);
-		if (!str) {
-			break;
-		}
-		if (header_printed) {
+			pthread_mutex_unlock(&lock_info->lock);
+			if (!str)
+				break;
 			ast_str_append(&str, 0, "=== -------------------------------------------------------------------\n"
-				"===\n");
-		}
-		if (!str) {
-			break;
+			               "===\n");
+			if (!str)
+				break;
 		}
 	}
 	pthread_mutex_unlock(&lock_infos_lock.mutex);




More information about the asterisk-commits mailing list