diff options
author | Matthew Jordan <mjordan@digium.com> | 2012-10-02 01:47:16 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2012-10-02 01:47:16 +0000 |
commit | a094707d5156a005fb6e9277bd4a14f9d7e7ab1c (patch) | |
tree | 26a15c7ef864995e2f2d89d09294024bad0145cb /main/taskprocessor.c | |
parent | 4e228fce0382550136e5c34cb4d9fd400b8d4ad3 (diff) |
Fix a variety of ref counting issues
This patch resolves a number of ref leaks that occur primarily on Asterisk
shutdown. It adds a variety of shutdown routines to core portions of
Asterisk such that they can reclaim resources allocate duringd initialization.
Review: https://reviewboard.asterisk.org/r/2137
........
Merged revisions 374177 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 374178 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374196 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374197 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/taskprocessor.c')
-rw-r--r-- | main/taskprocessor.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/main/taskprocessor.c b/main/taskprocessor.c index e92b6948b..912f891b1 100644 --- a/main/taskprocessor.c +++ b/main/taskprocessor.c @@ -122,6 +122,12 @@ static struct ast_cli_entry taskprocessor_clis[] = { AST_CLI_DEFINE(cli_tps_report, "List instantiated task processors and statistics"), }; +/*! \internal \brief Clean up resources on Asterisk shutdown */ +static void tps_shutdown(void) +{ + ao2_t_ref(tps_singletons, -1, "Unref tps_singletons in shutdown"); +} + /* initialize the taskprocessor container and register CLI operations */ int ast_tps_init(void) { @@ -133,6 +139,9 @@ int ast_tps_init(void) ast_cond_init(&cli_ping_cond, NULL); ast_cli_register_multiple(taskprocessor_clis, ARRAY_LEN(taskprocessor_clis)); + + ast_register_atexit(tps_shutdown); + return 0; } |