[svn-commits] murf: trunk r131570 - /trunk/include/asterisk/lock.h

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 16 18:53:03 CDT 2008


Author: murf
Date: Wed Jul 16 18:53:02 2008
New Revision: 131570

URL: http://svn.digium.com/view/asterisk?view=rev&rev=131570
Log:
(closes issue #13089)
Reported by: murf

Most of this bug was already fixed by Tilghman before
I opened it; Many thanks to Tilghman for his fix
in svn version 125794. That fix cleared up some of the
fields in the lock_info.

This commit changes the address that is stored for the
lock in the lock_info struct, so that it is the same 
as that passed into the locking macros. This makes 
searching for a lock_info (as in log_show_lock()) 
by its lock addr possible. The lock_addr field is
infinitely more useful if it is the same as what
is 'publicly' available outside the lock_info code.

Many thanks to kpfleming, putnopvut, and Russell for their
invaluable insights earlier today.


Modified:
    trunk/include/asterisk/lock.h

Modified: trunk/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/lock.h?view=diff&rev=131570&r1=131569&r2=131570
==============================================================================
--- trunk/include/asterisk/lock.h (original)
+++ trunk/include/asterisk/lock.h Wed Jul 16 18:53:02 2008
@@ -501,9 +501,9 @@
 		ast_bt_get_addresses(&lt->backtrace[lt->reentrancy]);
 		bt = &lt->backtrace[lt->reentrancy];
 		ast_reentrancy_unlock(lt);
-		ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex, bt);
-#else
-		ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex);
+		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
 	}
 
@@ -565,7 +565,7 @@
 		}
 		ast_reentrancy_unlock(lt);
 		if (t->tracking) {
-			ast_mark_lock_acquired(&t->mutex);
+			ast_mark_lock_acquired(t);
 		}
 	} else {
 #ifdef HAVE_BKTR
@@ -577,11 +577,11 @@
 			bt = NULL;
 		}
 		if (t->tracking) {
-			ast_remove_lock_info(&t->mutex, bt);
+			ast_remove_lock_info(t, bt);
 		}
 #else
 		if (t->tracking) {
-			ast_remove_lock_info(&t->mutex);
+			ast_remove_lock_info(t);
 		}
 #endif
 		__ast_mutex_logger("%s line %d (%s): Error obtaining mutex: %s\n",
@@ -623,9 +623,9 @@
 		ast_bt_get_addresses(&lt->backtrace[lt->reentrancy]);
 		bt = &lt->backtrace[lt->reentrancy];
 		ast_reentrancy_unlock(lt);
-		ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex, bt);
-#else
-		ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex);
+		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
 	}
 
@@ -643,10 +643,10 @@
 		}
 		ast_reentrancy_unlock(lt);
 		if (t->tracking) {
-			ast_mark_lock_acquired(&t->mutex);
+			ast_mark_lock_acquired(t);
 		}
 	} else if (t->tracking) {
-		ast_mark_lock_failed(&t->mutex);
+		ast_mark_lock_failed(t);
 	}
 
 	return res;
@@ -709,9 +709,9 @@
 
 	if (t->tracking) {
 #ifdef HAVE_BKTR
-		ast_remove_lock_info(&t->mutex, bt);
-#else
-		ast_remove_lock_info(&t->mutex);
+		ast_remove_lock_info(t, bt);
+#else
+		ast_remove_lock_info(t);
 #endif
 	}
 
@@ -806,9 +806,9 @@
 
 	if (t->tracking) {
 #ifdef HAVE_BKTR
-		ast_remove_lock_info(&t->mutex, bt);
-#else
-		ast_remove_lock_info(&t->mutex);
+		ast_remove_lock_info(t, bt);
+#else
+		ast_remove_lock_info(t);
 #endif
 	}
 
@@ -836,9 +836,9 @@
 
 		if (t->tracking) {
 #ifdef HAVE_BKTR
-			ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex, bt);
-#else
-			ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex);
+			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
 		}
 	}
@@ -903,9 +903,9 @@
 
 	if (t->tracking) {
 #ifdef HAVE_BKTR
-		ast_remove_lock_info(&t->mutex, bt);
-#else
-		ast_remove_lock_info(&t->mutex);
+		ast_remove_lock_info(t, bt);
+#else
+		ast_remove_lock_info(t);
 #endif
 	}
 	
@@ -933,9 +933,9 @@
 
 		if (t->tracking) {
 #ifdef HAVE_BKTR
-			ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex, bt);
-#else
-			ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex);
+			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
 		}
 	}
@@ -1115,9 +1115,9 @@
 
 	if (t->tracking) {
 #ifdef HAVE_BKTR
-		ast_remove_lock_info(&t->lock, bt);
-#else
-		ast_remove_lock_info(&t->lock);
+		ast_remove_lock_info(t, bt);
+#else
+		ast_remove_lock_info(t);
 #endif
 	}
 
@@ -1161,9 +1161,9 @@
 		ast_bt_get_addresses(&lt->backtrace[lt->reentrancy]);
 		bt = &lt->backtrace[lt->reentrancy];
 		ast_reentrancy_unlock(lt);	
-		ast_store_lock_info(AST_RDLOCK, filename, line, func, name, &t->lock, bt);
-#else
-		ast_store_lock_info(AST_RDLOCK, filename, line, func, name, &t->lock);
+		ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t, bt);
+#else
+		ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t);
 #endif
 	}
 	
@@ -1213,7 +1213,7 @@
 		}
 		ast_reentrancy_unlock(lt);
 		if (t->tracking) {
-			ast_mark_lock_acquired(&t->lock);
+			ast_mark_lock_acquired(t);
 		}
 	} else {
 #ifdef HAVE_BKTR
@@ -1225,11 +1225,11 @@
 			bt = NULL;
 		}
 		if (t->tracking) {
-			ast_remove_lock_info(&t->lock, bt);
+			ast_remove_lock_info(t, bt);
 		}
 #else
 		if (t->tracking) {
-			ast_remove_lock_info(&t->lock);
+			ast_remove_lock_info(t);
 		}
 #endif
 		__ast_mutex_logger("%s line %d (%s): Error obtaining read lock: %s\n",
@@ -1270,9 +1270,9 @@
 		ast_bt_get_addresses(&lt->backtrace[lt->reentrancy]);
 		bt = &lt->backtrace[lt->reentrancy];
 		ast_reentrancy_unlock(lt);
-		ast_store_lock_info(AST_WRLOCK, filename, line, func, name, &t->lock, bt);
-#else
-		ast_store_lock_info(AST_WRLOCK, filename, line, func, name, &t->lock);
+		ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt);
+#else
+		ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t);
 #endif
 	}
 #ifdef DETECT_DEADLOCKS
@@ -1321,7 +1321,7 @@
 		}
 		ast_reentrancy_unlock(lt);
 		if (t->tracking) {
-			ast_mark_lock_acquired(&t->lock);
+			ast_mark_lock_acquired(t);
 		}
 	} else {
 #ifdef HAVE_BKTR
@@ -1332,11 +1332,11 @@
 			bt = NULL;
 		}
 		if (t->tracking) {
-			ast_remove_lock_info(&t->lock, bt);
+			ast_remove_lock_info(t, bt);
 		}
 #else
 		if (t->tracking) {
-			ast_remove_lock_info(&t->lock);
+			ast_remove_lock_info(t);
 		}
 #endif
 		__ast_mutex_logger("%s line %d (%s): Error obtaining write lock: %s\n",
@@ -1378,9 +1378,9 @@
 		ast_bt_get_addresses(&lt->backtrace[lt->reentrancy]);
 		bt = &lt->backtrace[lt->reentrancy];
 		ast_reentrancy_unlock(lt);
-		ast_store_lock_info(AST_RDLOCK, filename, line, func, name, &t->lock, bt);
-#else
-		ast_store_lock_info(AST_RDLOCK, filename, line, func, name, &t->lock);
+		ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t, bt);
+#else
+		ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t);
 #endif
 	}
 	
@@ -1398,10 +1398,10 @@
 		}
 		ast_reentrancy_unlock(lt);
 		if (t->tracking) {
-			ast_mark_lock_acquired(&t->lock);
+			ast_mark_lock_acquired(t);
 		}
 	} else if (t->tracking) {
-		ast_mark_lock_failed(&t->lock);
+		ast_mark_lock_failed(t);
 	}
 	return res;
 }
@@ -1438,9 +1438,9 @@
 		ast_bt_get_addresses(&lt->backtrace[lt->reentrancy]);
 		bt = &lt->backtrace[lt->reentrancy];
 		ast_reentrancy_unlock(lt);
-		ast_store_lock_info(AST_WRLOCK, filename, line, func, name, &t->lock, bt);
-#else
-		ast_store_lock_info(AST_WRLOCK, filename, line, func, name, &t->lock);
+		ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt);
+#else
+		ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t);
 #endif
 	}
 	
@@ -1458,10 +1458,10 @@
 		}
 		ast_reentrancy_unlock(lt);
 		if (t->tracking) {
-			ast_mark_lock_acquired(&t->lock);
+			ast_mark_lock_acquired(t);
 		}
 	} else if (t->tracking) {
-		ast_mark_lock_failed(&t->lock);
+		ast_mark_lock_failed(t);
 	}
 	return res;
 }




More information about the svn-commits mailing list