diff options
author | Mark Michelson <mmichelson@digium.com> | 2013-01-15 19:36:33 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2013-01-15 19:36:33 +0000 |
commit | edc2e4dac0a6d532957fd27b6b784232cf2ae55c (patch) | |
tree | c85008d0d91b41d83d995bfea5eb852d5d5dd202 /include/asterisk | |
parent | 65c7d6e2c3d4fc3a161a31ff1e89d20256926fb1 (diff) |
Remove threadpool listener alloc and destroy callbacks.
This replaces the destroy callback with a shutdown callback
instead.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379122 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/threadpool.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/include/asterisk/threadpool.h b/include/asterisk/threadpool.h index f3995ffe7..5cc4ea4da 100644 --- a/include/asterisk/threadpool.h +++ b/include/asterisk/threadpool.h @@ -26,17 +26,9 @@ struct ast_threadpool_listener; struct ast_threadpool_listener_callbacks { /*! - * \brief Allocate the listener's private data - * - * It is not necessary to assign the private data to the listener. - * \param listener The listener the private data will belong to - * \retval NULL Failure to allocate private data - * \retval non-NULL The newly allocated private data - */ - void *(*alloc)(struct ast_threadpool_listener *listener); - /*! * \brief Indicates that the state of threads in the pool has changed * + * \param pool The pool whose state has changed * \param listener The threadpool listener * \param active_threads The number of active threads in the pool * \param idle_threads The number of idle threads in the pool @@ -48,6 +40,7 @@ struct ast_threadpool_listener_callbacks { /*! * \brief Indicates that a task was pushed to the threadpool * + * \param pool The pool that had a task pushed * \param listener The threadpool listener * \param was_empty Indicates whether there were any tasks prior to adding the new one. */ @@ -57,15 +50,21 @@ struct ast_threadpool_listener_callbacks { /*! * \brief Indicates the threadpool's taskprocessor has become empty * + * \param pool The pool that has become empty * \param listener The threadpool's listener */ void (*emptied)(struct ast_threadpool *pool, struct ast_threadpool_listener *listener); /*! - * \brief Free the listener's private data - * \param private_data The private data to destroy + * \brief The threadpool is shutting down + * + * This would be an opportune time to free the listener's user data + * if one wishes. However, it is acceptable to not do so if the user data + * should persist beyond the lifetime of the pool. + * + * \param listener The threadpool's listener */ - void (*destroy)(void *private_data); + void (*shutdown)(struct ast_threadpool_listener *listener); }; /*! @@ -79,7 +78,7 @@ struct ast_threadpool_listener { /*! Callbacks called by the threadpool */ const struct ast_threadpool_listener_callbacks *callbacks; /*! User data for the listener */ - void *private_data; + void *user_data; }; struct ast_threadpool_options { @@ -112,11 +111,12 @@ struct ast_threadpool_options { * listener. * * \param callbacks Listener callbacks to assign to the listener + * \param user_data User data to be stored in the threadpool listener * \retval NULL Failed to allocate the listener * \retval non-NULL The newly-created threadpool listener */ struct ast_threadpool_listener *ast_threadpool_listener_alloc( - const struct ast_threadpool_listener_callbacks *callbacks); + const struct ast_threadpool_listener_callbacks *callbacks, void *user_data); /*! * \brief Create a new threadpool |