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

Kevin P. Fleming kpfleming at digium.com
Tue May 16 14:16:09 MST 2006


Luigi Rizzo wrote:

> 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.

This is only true when DEBUG_THREADS is enabled for the compile. In
spite of that, I don't see how this was ever expected to work for
structures that are allocated using calloc() anyway, since the mutex
will clearly not have this initial value. Your change may help one case
of this, but there are lots of other places in the code where we
allocate structures and then initialize locks inside them.

I suspect the proper change is to revert this one, and then modify
__ast_pthread_mutex_init_attr() to only complain if the mutex value is
not PTHREAD_MUTEX_INITIALIZER and is _also_ not zero.



More information about the asterisk-dev mailing list