[asterisk-commits] russell: trunk r202109 - in /trunk: cdr/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jun 20 09:09:44 CDT 2009


Author: russell
Date: Sat Jun 20 09:09:40 2009
New Revision: 202109

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=202109
Log:
Remove unnecessary usleep() from a couple of module unload callbacks.

In passing, also tweak cdr_unregister() to hold the list lock a bit less time.

Modified:
    trunk/cdr/cdr_adaptive_odbc.c
    trunk/cdr/cdr_pgsql.c
    trunk/main/cdr.c

Modified: trunk/cdr/cdr_adaptive_odbc.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/cdr/cdr_adaptive_odbc.c?view=diff&rev=202109&r1=202108&r2=202109
==============================================================================
--- trunk/cdr/cdr_adaptive_odbc.c (original)
+++ trunk/cdr/cdr_adaptive_odbc.c Sat Jun 20 09:09:40 2009
@@ -663,7 +663,6 @@
 static int unload_module(void)
 {
 	ast_cdr_unregister(name);
-	usleep(1);
 	if (AST_RWLIST_WRLOCK(&odbc_tables)) {
 		ast_cdr_register(name, ast_module_info->description, odbc_log);
 		ast_log(LOG_ERROR, "Unable to lock column list.  Unload failed.\n");

Modified: trunk/cdr/cdr_pgsql.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/cdr/cdr_pgsql.c?view=diff&rev=202109&r1=202108&r2=202109
==============================================================================
--- trunk/cdr/cdr_pgsql.c (original)
+++ trunk/cdr/cdr_pgsql.c Sat Jun 20 09:09:40 2009
@@ -331,10 +331,9 @@
 static int unload_module(void)
 {
 	struct columns *current;
+
 	ast_cdr_unregister(name);
 
-	/* Give all threads time to finish */
-	usleep(1);
 	PQfinish(conn);
 
 	if (pghostname)

Modified: trunk/main/cdr.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/main/cdr.c?view=diff&rev=202109&r1=202108&r2=202109
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Sat Jun 20 09:09:40 2009
@@ -148,13 +148,16 @@
 	AST_RWLIST_TRAVERSE_SAFE_BEGIN(&be_list, i, list) {
 		if (!strcasecmp(name, i->name)) {
 			AST_RWLIST_REMOVE_CURRENT(list);
-			ast_verb(2, "Unregistered '%s' CDR backend\n", name);
-			ast_free(i);
 			break;
 		}
 	}
 	AST_RWLIST_TRAVERSE_SAFE_END;
 	AST_RWLIST_UNLOCK(&be_list);
+
+	if (i) {
+		ast_verb(2, "Unregistered '%s' CDR backend\n", name);
+		ast_free(i);
+	}
 }
 
 int ast_cdr_isset_unanswered(void)




More information about the asterisk-commits mailing list