[asterisk-commits] file: branch 1.4 r104596 - /branches/1.4/main/loader.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 27 11:07:33 CST 2008


Author: file
Date: Wed Feb 27 11:07:33 2008
New Revision: 104596

URL: http://svn.digium.com/view/asterisk?view=rev&rev=104596
Log:
Use the lock (which already existed, it just wasn't used) on the updaters list to protect the contents instead of the overall module list lock.
(closes issue #12080)
Reported by: ChaseVenters

Modified:
    branches/1.4/main/loader.c

Modified: branches/1.4/main/loader.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/loader.c?view=diff&rev=104596&r1=104595&r2=104596
==============================================================================
--- branches/1.4/main/loader.c (original)
+++ branches/1.4/main/loader.c Wed Feb 27 11:07:33 2008
@@ -905,10 +905,10 @@
 	   resource has changed */
 	struct loadupdate *m;
 
-	AST_LIST_LOCK(&module_list);
+	AST_LIST_LOCK(&updaters);
 	AST_LIST_TRAVERSE(&updaters, m, entry)
 		m->updater();
-	AST_LIST_UNLOCK(&module_list);
+	AST_LIST_UNLOCK(&updaters);
 }
 
 int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *like),
@@ -939,9 +939,9 @@
 		return -1;
 
 	tmp->updater = v;
-	AST_LIST_LOCK(&module_list);
+	AST_LIST_LOCK(&updaters);
 	AST_LIST_INSERT_HEAD(&updaters, tmp, entry);
-	AST_LIST_UNLOCK(&module_list);
+	AST_LIST_UNLOCK(&updaters);
 
 	return 0;
 }
@@ -950,7 +950,7 @@
 {
 	struct loadupdate *cur;
 
-	AST_LIST_LOCK(&module_list);
+	AST_LIST_LOCK(&updaters);
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&updaters, cur, entry) {
 		if (cur->updater == v)	{
 			AST_LIST_REMOVE_CURRENT(&updaters, entry);
@@ -958,7 +958,7 @@
 		}
 	}
 	AST_LIST_TRAVERSE_SAFE_END;
-	AST_LIST_UNLOCK(&module_list);
+	AST_LIST_UNLOCK(&updaters);
 
 	return cur ? 0 : -1;
 }




More information about the asterisk-commits mailing list