diff options
author | Mark Michelson <mmichelson@digium.com> | 2013-01-17 16:04:10 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2013-01-17 16:04:10 +0000 |
commit | 84c50fde1fef6ec1a8930b9b6217bf3c3d99d2c7 (patch) | |
tree | ae8f3134845ad3dad6d063e848ddf2bcbb30a78f /include | |
parent | 299f913928d34600a777b59211d125d2b0b53a6b (diff) |
Address David's latest feedback on reviewboard:
* Add a max_size option for threadpools. Also added a test for this option.
* Fixed comments to be more accurate and have fewer typos.
* Updated copyright dates on new files.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379375 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/taskprocessor.h | 4 | ||||
-rw-r--r-- | include/asterisk/threadpool.h | 16 |
2 files changed, 16 insertions, 4 deletions
diff --git a/include/asterisk/taskprocessor.h b/include/asterisk/taskprocessor.h index 708b3d750..219166305 100644 --- a/include/asterisk/taskprocessor.h +++ b/include/asterisk/taskprocessor.h @@ -163,7 +163,9 @@ struct ast_taskprocessor *ast_taskprocessor_get(const char *name, enum ast_tps_o * * \since 12.0.0 * - * The listener's alloc() and start() callbacks will be called during this function. + * Note that when a taskprocessor is created in this way, it does not create + * any threads to execute the tasks. This job is left up to the listener. + * The listener's start() callback will be called during this function. * * \param name The name of the taskprocessor to create * \param listener The listener for operations on this taskprocessor diff --git a/include/asterisk/threadpool.h b/include/asterisk/threadpool.h index 04daa9faa..e18ba6c69 100644 --- a/include/asterisk/threadpool.h +++ b/include/asterisk/threadpool.h @@ -1,7 +1,7 @@ /* * Asterisk -- An open source telephony toolkit. * - * Copyright (C) 2012, Digium, Inc. + * Copyright (C) 2012-2013, Digium, Inc. * * Mark Michelson <mmmichelson@digium.com> * @@ -69,7 +69,7 @@ struct ast_threadpool_listener_callbacks { struct ast_threadpool_options { #define AST_THREADPOOL_OPTIONS_VERSION 1 - /*! Version of thradpool options in use */ + /*! Version of threadpool options in use */ int version; /*! * \brief Time limit in seconds for idle threads @@ -98,6 +98,13 @@ struct ast_threadpool_options { * without any threads allocated. */ int initial_size; + /*! + * \brief Maximum number of threads a pool may have + * + * When the threadpool's size increases, it can never increase + * beyond this number of threads. + */ + int max_size; }; /*! @@ -127,7 +134,10 @@ void *ast_threadpool_listener_get_user_data(const struct ast_threadpool_listener * This function creates a threadpool. Tasks may be pushed onto this thread pool * in and will be automatically acted upon by threads within the pool. * - * \param name The name for the threadpool + * Only a single threadpool with a given name may exist. This function will fail + * if a threadpool with the given name already exists. + * + * \param name The unique name for the threadpool * \param listener The listener the threadpool will notify of changes. Can be NULL. * \param options The behavioral options for this threadpool * \retval NULL Failed to create the threadpool |