* to control threadpool growth yourself via your listener.
*/
int auto_increment;
+ /*!
+ * \brief Number of threads the pool will start with
+ *
+ * When the threadpool is allocated, it will immediately size
+ * itself to have this number of threads in it.
+ *
+ * Zero is a valid value if the threadpool should start
+ * without any threads allocated.
+ */
+ int initial_size;
};
/*!
*
* \param name The name for the threadpool
* \param listener The listener the threadpool will notify of changes
- * \param initial_size The number of threads for the pool to start with
+ * \param options The behavioral options for this threadpool
* \retval NULL Failed to create the threadpool
* \retval non-NULL The newly-created threadpool
*/
struct ast_threadpool *ast_threadpool_create(const char *name,
struct ast_threadpool_listener *listener,
- int initial_size, const struct ast_threadpool_options *options);
+ const struct ast_threadpool_options *options);
/*!
* \brief Set the number of threads for the thread pool
.version = AST_THREADPOOL_OPTIONS_VERSION,
.idle_timeout = 0,
.auto_increment = 0,
+ .initial_size = 0,
};
switch (cmd) {
goto end;
}
- pool = ast_threadpool_create(info->name, listener, 0, &options);
+ pool = ast_threadpool_create(info->name, listener, &options);
if (!pool) {
goto end;
}
.version = AST_THREADPOOL_OPTIONS_VERSION,
.idle_timeout = 0,
.auto_increment = 0,
+ .initial_size = 3,
};
switch (cmd) {
goto end;
}
- pool = ast_threadpool_create(info->name, listener, 3, &options);
+ pool = ast_threadpool_create(info->name, listener, &options);
if (!pool) {
goto end;
}
.version = AST_THREADPOOL_OPTIONS_VERSION,
.idle_timeout = 0,
.auto_increment = 0,
+ .initial_size = 0,
};
switch (cmd) {
goto end;
}
- pool = ast_threadpool_create(info->name, listener, 0, &options);
+ pool = ast_threadpool_create(info->name, listener, &options);
if (!pool) {
goto end;
}
.version = AST_THREADPOOL_OPTIONS_VERSION,
.idle_timeout = 0,
.auto_increment = 0,
+ .initial_size = 0,
};
switch (cmd) {
goto end;
}
- pool = ast_threadpool_create(info->name, listener, 0, &options);
+ pool = ast_threadpool_create(info->name, listener, &options);
if (!pool) {
goto end;
}
.version = AST_THREADPOOL_OPTIONS_VERSION,
.idle_timeout = 2,
.auto_increment = 0,
+ .initial_size = 0,
};
switch (cmd) {
goto end;
}
- pool = ast_threadpool_create(info->name, listener, 0, &options);
+ pool = ast_threadpool_create(info->name, listener, &options);
if (!pool) {
goto end;
}
.version = AST_THREADPOOL_OPTIONS_VERSION,
.idle_timeout = 0,
.auto_increment = 0,
+ .initial_size = 0,
};
switch (cmd) {
goto end;
}
- pool = ast_threadpool_create(info->name, listener, 0, &options);
+ pool = ast_threadpool_create(info->name, listener, &options);
if (!pool) {
goto end;
}
.version = AST_THREADPOOL_OPTIONS_VERSION,
.idle_timeout = 0,
.auto_increment = 0,
+ .initial_size = 0,
};
switch (cmd) {
goto end;
}
- pool = ast_threadpool_create(info->name, listener, 0, &options);
+ pool = ast_threadpool_create(info->name, listener, &options);
if (!pool) {
goto end;
}
.version = AST_THREADPOOL_OPTIONS_VERSION,
.idle_timeout = 0,
.auto_increment = 0,
+ .initial_size = 0,
};
switch (cmd) {
goto end;
}
- pool = ast_threadpool_create(info->name, listener, 0, &options);
+ pool = ast_threadpool_create(info->name, listener, &options);
if (!pool) {
goto end;
}
.version = AST_THREADPOOL_OPTIONS_VERSION,
.idle_timeout = 0,
.auto_increment = 3,
+ .initial_size = 0,
};
switch (cmd) {
goto end;
}
- pool = ast_threadpool_create(info->name, listener, 0, &options);
+ pool = ast_threadpool_create(info->name, listener, &options);
if (!pool) {
goto end;
}
.version = AST_THREADPOOL_OPTIONS_VERSION,
.idle_timeout = 0,
.auto_increment = 0,
+ .initial_size = 0,
};
switch (cmd) {
goto end;
}
- pool = ast_threadpool_create(info->name, listener, 0, &options);
+ pool = ast_threadpool_create(info->name, listener, &options);
if (!pool) {
goto end;
}
.version = AST_THREADPOOL_OPTIONS_VERSION,
.idle_timeout = 0,
.auto_increment = 0,
+ .initial_size = 0,
};
switch (cmd) {
goto end;
}
- pool = ast_threadpool_create(info->name, listener, 0, &options);
+ pool = ast_threadpool_create(info->name, listener, &options);
if (!pool) {
goto end;
}
.version = AST_THREADPOOL_OPTIONS_VERSION,
.idle_timeout = 0,
.auto_increment = 0,
+ .initial_size = 0,
};
switch (cmd) {
goto end;
}
- pool = ast_threadpool_create(info->name, listener, 0, &options);
+ pool = ast_threadpool_create(info->name, listener, &options);
if (!pool) {
goto end;
}