[asterisk-commits] rizzo: trunk r47731 - /trunk/main/cli.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Nov 16 07:41:28 MST 2006


Author: rizzo
Date: Thu Nov 16 08:41:28 2006
New Revision: 47731

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47731
Log:
use atomic instructions to update the inuse counters
for CLI entriesC. The lock is not protecting this field.

I wonder if the field should be declared 'volatile' as well.


Modified:
    trunk/main/cli.c

Modified: trunk/main/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cli.c?view=diff&rev=47731&r1=47730&r2=47731
==============================================================================
--- trunk/main/cli.c (original)
+++ trunk/main/cli.c Thu Nov 16 08:41:28 2006
@@ -1640,7 +1640,7 @@
 		AST_LIST_LOCK(&helpers);
 		e = find_cli(args + 1, 0);
 		if (e)
-			e->inuse++;
+			ast_atomic_fetchadd_int(&e->inuse, 1);
 		AST_LIST_UNLOCK(&helpers);
 		if (e) {
 			int res;



More information about the asterisk-commits mailing list