[asterisk-commits] russell: trunk r80226 - /trunk/funcs/func_odbc.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 21 16:58:30 CDT 2007


Author: russell
Date: Tue Aug 21 16:58:29 2007
New Revision: 80226

URL: http://svn.digium.com/view/asterisk?view=rev&rev=80226
Log:
use ast_atomic_fetchadd_int for incrementing resultcount

Modified:
    trunk/funcs/func_odbc.c

Modified: trunk/funcs/func_odbc.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_odbc.c?view=diff&rev=80226&r1=80225&r2=80226
==============================================================================
--- trunk/funcs/func_odbc.c (original)
+++ trunk/funcs/func_odbc.c Tue Aug 21 16:58:29 2007
@@ -94,7 +94,6 @@
 AST_LIST_HEAD_STATIC(queries, acf_odbc_query);
 
 static int resultcount = 0;
-AST_MUTEX_DEFINE_STATIC(resultlock);
 
 static void odbc_datastore_free(void *data)
 {
@@ -448,9 +447,7 @@
 	if (resultset) {
 		int uid;
 		struct ast_datastore *odbc_store;
-		ast_mutex_lock(&resultlock);
-		uid = ++resultcount;
-		ast_mutex_unlock(&resultlock);
+		uid = ast_atomic_fetchadd_int(&resultcount, +1) + 1;
 		snprintf(buf, len, "%d", uid);
 		odbc_store = ast_channel_datastore_alloc(&odbc_info, buf);
 		if (!odbc_store) {




More information about the asterisk-commits mailing list