[asterisk-dev] [Code Review] Fix how mutexes are created/destroyed on platforms which need constructors

Tilghman Lesher tlesher at digium.com
Mon Nov 8 16:02:21 CST 2010



> On 2010-09-03 16:50:07, Russell Bryant wrote:
> > I would also suggest using a constructor priority on the ast_module_info registration constructor.  Make sure that it is at a lower priority than any of the data in the module that gets initialized by constructors.
> > 
> > *mumbles something about hating the usage of constructors on global variables and wishing we could make it all go away...*

Actually, we would want it to be at a higher priority.  The reason for this is simple:  by the time the module gets referenced in the core, which is what the module constructor does, we want all constructors within the module to have already run.  Otherwise, we could potentially try to execute load_module before all mutexes within that module were initialized.


- Tilghman


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/894/#review2677
-----------------------------------------------------------


On 2010-09-03 13:35:19, Tilghman Lesher wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/894/
> -----------------------------------------------------------
> 
> (Updated 2010-09-03 13:35:19)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> Checks for a new constructor argument, as of gcc 4.3, which allows priorities to be assigned to each constructor, thus indicating a construction order (ascending) and destructor order (descending).  Also removes the destructor for files in main, when priorities aren't available.
> 
> 
> Diffs
> -----
> 
>   /branches/1.4/include/asterisk/linkedlists.h 284776 
>   /branches/1.4/configure UNKNOWN 
>   /branches/1.4/configure.ac 284776 
>   /branches/1.4/include/asterisk/autoconfig.h.in 284776 
>   /branches/1.4/autoconf/ast_gcc_attribute.m4 284776 
>   /branches/1.4/include/asterisk/lock.h 284776 
>   /branches/1.4/main/Makefile 284776 
> 
> Diff: https://reviewboard.asterisk.org/r/894/diff
> 
> 
> Testing
> -------
> 
> Eliminates some of the warnings on OS X 10.6 (gcc 4.2) upon quit, as mutexes don't get destroyed too early.
> 
> 
> Thanks,
> 
> Tilghman
> 
>




More information about the asterisk-dev mailing list