[asterisk-dev] Re: [asterisk-commits] trunk r26954 - /trunk/include/asterisk/linkedlists.h

Luigi Rizzo rizzo at icir.org
Mon May 15 13:04:20 MST 2006


On Mon, May 15, 2006 at 02:50:09PM -0500, Kevin P. Fleming wrote:
> asterisk-commits at lists.digium.com wrote:
> 
> > Modified: trunk/include/asterisk/linkedlists.h
> > URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/linkedlists.h?rev=26954&r1=26953&r2=26954&view=diff
> > ==============================================================================
> > --- trunk/include/asterisk/linkedlists.h (original)
> > +++ trunk/include/asterisk/linkedlists.h Thu May 11 10:50:25 2006
> > @@ -363,6 +363,7 @@
> >  #define AST_LIST_HEAD_INIT(head) {					\
> >  	(head)->first = NULL;						\
> >  	(head)->last = NULL;						\
> > +	(head)->lock = AST_MUTEX_INIT_VALUE;				\
> >  	ast_mutex_init(&(head)->lock);					\
> >  }
> 
> This looks completely wrong. Why doesn't ast_mutex_init() work on your
> platform? It's already being called here, there is no reason to manually
> initialize the lock as well, is there?

yes there is -- ast_mutex_init() first checks if
 (head)->lock == AST_MUTEX_INIT_VALUE, and if not it complains
that the mutex has been already initialized.

cheers
luigi



More information about the asterisk-dev mailing list