mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-05 04:32:44 +00:00
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
This commit is contained in:
@@ -25,18 +25,10 @@ struct ast_taskprocessor;
|
||||
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
|
||||
|
Reference in New Issue
Block a user