summaryrefslogtreecommitdiff
path: root/main/threadpool.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2012-12-10 20:14:23 +0000
committerMark Michelson <mmichelson@digium.com>2012-12-10 20:14:23 +0000
commit1310e659bd0b4b0ce8210b5b1318ae71d86b85e2 (patch)
tree8e097572cfef1f0b05602f7ef17ec10f4fb3c439 /main/threadpool.c
parent90d76a50263a6ff509d2b26c9953c2d700854a9b (diff)
Solve the issue about the "CHANGE THIS" and "XXX CHANGE THIS XXX" taskprocessor names.
Unfortunately, this required a taskprocessor listener change that makes listener allocation utterly silly. I'm going to change the scheme so that allocation of taskprocessor listeners is done internally within taskprocessor code. This will make it parallel with threadpool code, which is a good thing. git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377687 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/threadpool.c')
-rw-r--r--main/threadpool.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/main/threadpool.c b/main/threadpool.c
index 18c1349ae..ee60dc7e3 100644
--- a/main/threadpool.c
+++ b/main/threadpool.c
@@ -349,8 +349,15 @@ static void *threadpool_alloc(struct ast_taskprocessor_listener *listener)
{
RAII_VAR(struct ast_threadpool *, pool,
ao2_alloc(sizeof(*pool), threadpool_destructor), ao2_cleanup);
+ struct ast_str *name = ast_str_create(64);
- pool->control_tps = ast_taskprocessor_get("CHANGE THIS", TPS_REF_DEFAULT);
+ if (!name) {
+ return NULL;
+ }
+
+ ast_str_set(&name, 0, "%s-control", ast_taskprocessor_name(listener->tps));
+
+ pool->control_tps = ast_taskprocessor_get(ast_str_buffer(name), TPS_REF_DEFAULT);
if (!pool->control_tps) {
return NULL;
}
@@ -782,7 +789,8 @@ struct pool_options_pair {
struct ast_threadpool_options options;
};
-struct ast_threadpool *ast_threadpool_create(struct ast_threadpool_listener *listener,
+struct ast_threadpool *ast_threadpool_create(const char *name,
+ struct ast_threadpool_listener *listener,
int initial_size, const struct ast_threadpool_options *options)
{
struct ast_threadpool *pool;
@@ -795,7 +803,7 @@ struct ast_threadpool *ast_threadpool_create(struct ast_threadpool_listener *lis
return NULL;
}
- tps = ast_taskprocessor_create_with_listener("XXX CHANGE THIS XXX", tps_listener);
+ tps = ast_taskprocessor_create_with_listener(name, tps_listener);
if (!tps) {
return NULL;