[asterisk-dev] [Code Review] 2826: Debug threads: avoid double-initialization of lock tracking
rmudgett
reviewboard at asterisk.org
Thu Sep 5 12:55:45 CDT 2013
> On Sept. 5, 2013, 5:45 p.m., Mark Michelson wrote:
> > /branches/1.8/main/lock.c, line 90
> > <https://reviewboard.asterisk.org/r/2826/diff/1/?file=45645#file45645line90>
> >
> > 1) No need for the cast
> > 2) I believe the trendy way to do this now is to call ast_std_calloc() instead of calloc().
There is nothing trendy about it. If you think you are using the standard library allocation routines by calling plain calloc() you will most likely be wrong. The standard allocation routines get redirected by the C preprocessor to the allocation routines in astmm.c by MALLOC_DEBUG.
- rmudgett
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2826/#review9602
-----------------------------------------------------------
On Sept. 5, 2013, 4:36 p.m., David Lee wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2826/
> -----------------------------------------------------------
>
> (Updated Sept. 5, 2013, 4:36 p.m.)
>
>
> Review request for Asterisk Developers and Matt Jordan.
>
>
> Bugs: ASTERISK-19463
> https://issues.asterisk.org/jira/browse/ASTERISK-19463
>
>
> Repository: Asterisk
>
>
> Description
> -------
>
> This patch corrects a consistency issue with debug threads that I
> noticed while fixing ASTERISK-22455.
>
> The initialization of a mutex's lock tracking structure was not
> protected in a critical section. This is fine for any mutex that is
> explicitly initialized, but a static mutex may have its lock tracking
> double-initialized if multiple threads attempt the first lock
> simultaneously.
>
> This patch creates a global mutex to properly serialize the
> initialization of the lock tracking structure for a mutex. It also
> changes lock.c to properly handle allocation failures of the lock
> tracking structure.
>
>
> Diffs
> -----
>
> /branches/1.8/include/asterisk/lock.h 398378
> /branches/1.8/main/lock.c 398378
>
> Diff: https://reviewboard.asterisk.org/r/2826/diff/
>
>
> Testing
> -------
>
> I propose we setup Bamboo to run the TestSuite with DEBUG_THREADS
> enabled on this branch nightly for a few weeks.
>
>
> Thanks,
>
> David Lee
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130905/3169843f/attachment.htm>
More information about the asterisk-dev
mailing list