From: Luigi Rizzo Date: Thu, 16 Nov 2006 14:41:28 +0000 (+0000) Subject: use atomic instructions to update the inuse counters X-Git-Tag: 1.6.0-beta1~3^2~3945 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e58079b06707d030990bfca3941d5887ab7bd212;p=thirdparty%2Fasterisk.git 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. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47731 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/cli.c b/main/cli.c index 2dc6afa1fe..c5fe8b331f 100644 --- a/main/cli.c +++ b/main/cli.c @@ -1640,7 +1640,7 @@ int ast_cli_command(int fd, const char *s) 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;