[asterisk-commits] twilson: trunk r121365 - /trunk/main/taskprocessor.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jun 9 17:42:08 CDT 2008
Author: twilson
Date: Mon Jun 9 17:42:08 2008
New Revision: 121365
URL: http://svn.digium.com/view/asterisk?view=rev&rev=121365
Log:
Initialize the lock and destroy lock and cond in the destructor (thanks, mmichelson)
Modified:
trunk/main/taskprocessor.c
Modified: trunk/main/taskprocessor.c
URL: http://svn.digium.com/view/asterisk/trunk/main/taskprocessor.c?view=diff&rev=121365&r1=121364&r2=121365
==============================================================================
--- trunk/main/taskprocessor.c (original)
+++ trunk/main/taskprocessor.c Mon Jun 9 17:42:08 2008
@@ -354,6 +354,8 @@
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 @@
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 @@
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);
More information about the asterisk-commits
mailing list