summaryrefslogtreecommitdiff
path: root/main/taskprocessor.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2013-01-07 23:11:41 +0000
committerMark Michelson <mmichelson@digium.com>2013-01-07 23:11:41 +0000
commit99701cd1d109a1ca41d79a20251bb40e4e9d3150 (patch)
tree5bd3aa67ab3efe8ce6624527058cc6acad3c106e /main/taskprocessor.c
parenta08847c270f98550d8f2ffe141ae923fd941b6b7 (diff)
Remove tasks from the taskprocessor and free them when taskprocessor is destroyed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378654 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/taskprocessor.c')
-rw-r--r--main/taskprocessor.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/main/taskprocessor.c b/main/taskprocessor.c
index 6ab0e1277..95bff720e 100644
--- a/main/taskprocessor.c
+++ b/main/taskprocessor.c
@@ -417,6 +417,7 @@ static int tps_cmp_cb(void *obj, void *arg, int flags)
static void tps_taskprocessor_destroy(void *tps)
{
struct ast_taskprocessor *t = tps;
+ struct tps_task *task;
if (!tps) {
ast_log(LOG_ERROR, "missing taskprocessor\n");
@@ -437,6 +438,9 @@ static void tps_taskprocessor_destroy(void *tps)
ao2_ref(t->listener, -1);
t->listener = NULL;
}
+ while ((task = AST_LIST_REMOVE_HEAD(&t->tps_queue, list))) {
+ tps_task_free(task);
+ }
}
/* pop the front task and return it */