diff options
author | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-06-09 22:42:08 +0000 |
---|---|---|
committer | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-06-09 22:42:08 +0000 |
commit | 3f654c0868447eb00e24870f1a8f5798ad74199a (patch) | |
tree | 51db13471fcc43117a0a1afe5a669de75c95e82d /main | |
parent | 9c234cec9a3e0060a88e42f988723be0da15dba4 (diff) |
Initialize the lock and destroy lock and cond in the destructor (thanks, mmichelson)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@121365 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/taskprocessor.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/main/taskprocessor.c b/main/taskprocessor.c index ebe708302..8b065e45c 100644 --- a/main/taskprocessor.c +++ b/main/taskprocessor.c @@ -354,6 +354,8 @@ static void tps_taskprocessor_destroy(void *tps) ast_mutex_unlock(&t->taskprocessor_lock); pthread_join(t->poll_thread, NULL); t->poll_thread = AST_PTHREADT_NULL; + ast_mutex_destroy(&t->taskprocessor_lock); + ast_cond_destroy(&t->poll_cond); /* free it */ if (t->stats) { ast_free(t->stats); @@ -424,6 +426,10 @@ struct ast_taskprocessor *ast_taskprocessor_get(char *name, enum ast_tps_options ast_log(LOG_WARNING, "failed to create taskprocessor '%s'\n", name); return NULL; } + + ast_cond_init(&p->poll_cond, NULL); + ast_mutex_init(&p->taskprocessor_lock); + if (!(p->stats = ast_calloc(1, sizeof(*p->stats)))) { ao2_unlock(tps_singletons); ast_log(LOG_WARNING, "failed to create taskprocessor stats for '%s'\n", name); @@ -436,7 +442,6 @@ struct ast_taskprocessor *ast_taskprocessor_get(char *name, enum ast_tps_options return NULL; } p->poll_thread_run = 1; - ast_cond_init(&p->poll_cond, NULL); p->poll_thread = AST_PTHREADT_NULL; if (ast_pthread_create(&p->poll_thread, NULL, tps_processing_function, p) < 0) { ao2_unlock(tps_singletons); |