[Asterisk-Dev] Re: [Asterisk-cvs] asterisk/include/asterisk module.h, 1.18, 1.19

Slav Klenov slav at securax.org
Fri Jun 24 04:06:00 MST 2005


Hi Kevin,

Is it guaranteed that the res = localusecnt assignement, without holding 
a lock,
can be done safely, without any possibility of damaging res? I'm not 
sure if this
can be considered as an atomic operation.

Slav


kpfleming at lists.digium.com wrote:

>Update of /usr/cvsroot/asterisk/include/asterisk
>In directory mongoose.digium.com:/tmp/cvs-serv24396/include/asterisk
>
>Modified Files:
>	module.h 
>Log Message:
>don't use locks when reading usecounts (reading only, not writing)
>
>
>Index: module.h
>===================================================================
>RCS file: /usr/cvsroot/asterisk/include/asterisk/module.h,v
>retrieving revision 1.18
>retrieving revision 1.19
>diff -u -d -r1.18 -r1.19
>--- module.h	6 Jun 2005 20:27:51 -0000	1.18
>+++ module.h	24 Jun 2005 02:15:04 -0000	1.19
>@@ -210,9 +210,7 @@
> }
> 
> #define STANDARD_USECOUNT(res) { \
>-	ast_mutex_lock(&localuser_lock); \
> 	res = localusecnt; \
>-	ast_mutex_unlock(&localuser_lock); \
> }
> 	
> 	
>
>_______________________________________________
>Asterisk-Cvs mailing list
>Asterisk-Cvs at lists.digium.com
>http://lists.digium.com/mailman/listinfo/asterisk-cvs
>
>  
>




More information about the asterisk-dev mailing list