diff options
author | Richard Mudgett <rmudgett@digium.com> | 2013-02-28 21:31:14 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2013-02-28 21:31:14 +0000 |
commit | 855bb334c8ad6cace55d875bc4aeddc1a81b005f (patch) | |
tree | 9cfaa1635b29b759ccd04393f4a861c627d212de /main/threadpool.c | |
parent | e2832f18bc50a4430ae1536ff7a588008a5528cf (diff) |
threadpool: Make ast_threadpool_push() return -1 if shutting_down
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382295 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/threadpool.c')
-rw-r--r-- | main/threadpool.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/main/threadpool.c b/main/threadpool.c index 68d84aff8..58647d59f 100644 --- a/main/threadpool.c +++ b/main/threadpool.c @@ -898,7 +898,7 @@ int ast_threadpool_push(struct ast_threadpool *pool, int (*task)(void *data), vo if (!pool->shutting_down) { return ast_taskprocessor_push(pool->tps, task, data); } - return 0; + return -1; } void ast_threadpool_shutdown(struct ast_threadpool *pool) @@ -1143,7 +1143,9 @@ static void serializer_task_pushed(struct ast_taskprocessor_listener *listener, struct serializer *ser = ast_taskprocessor_listener_get_user_data(listener); struct ast_taskprocessor *tps = ast_taskprocessor_listener_get_tps(listener); - ast_threadpool_push(ser->pool, execute_tasks, tps); + if (ast_threadpool_push(ser->pool, execute_tasks, tps)) { + ast_taskprocessor_unreference(tps); + } } } |