summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2012-12-10 06:13:09 +0000
committerMark Michelson <mmichelson@digium.com>2012-12-10 06:13:09 +0000
commit64deed062a6c79124dbc3b5d09c770a7a3f20f1c (patch)
tree8e182a35753bcb81b53d973dbbd8d89e150b813d /include
parent5dd22df050264299b42160daeaa7701c81488ceb (diff)
Add threadpool options and accompanying test.
The only test added so far is an idle thread timeout option. This will greatly aid threadpool users who wish to maintain a threadpool by allowing for idle threads to die out as necessary. Test passes. git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/threadpool.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/asterisk/threadpool.h b/include/asterisk/threadpool.h
index 6bb0dcc4f..3f3634129 100644
--- a/include/asterisk/threadpool.h
+++ b/include/asterisk/threadpool.h
@@ -82,6 +82,18 @@ struct ast_threadpool_listener {
void *private_data;
};
+struct ast_threadpool_options {
+#define AST_THREADPOOL_OPTIONS_VERSION 1
+ /*! Version of thradpool options in use */
+ int version;
+ /* !
+ * \brief Time limit in seconds for idle threads
+ *
+ * A time of 0 or less will mean an infinite timeout.
+ */
+ int idle_timeout;
+};
+
/*!
* \brief Allocate a threadpool listener
*
@@ -106,7 +118,8 @@ struct ast_threadpool_listener *ast_threadpool_listener_alloc(
* \retval NULL Failed to create the threadpool
* \retval non-NULL The newly-created threadpool
*/
-struct ast_threadpool *ast_threadpool_create(struct ast_threadpool_listener *listener, int initial_size);
+struct ast_threadpool *ast_threadpool_create(struct ast_threadpool_listener *listener,
+ int initial_size, const struct ast_threadpool_options *options);
/*!
* \brief Set the number of threads for the thread pool