* \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
- * \param zombie_threads The number of zombie threads in the pool
*/
void (*state_changed)(struct ast_threadpool_listener *listener,
int active_threads,
- int idle_threads,
- int zombie_threads);
+ int idle_threads);
/*!
* \brief Indicates that a task was pushed to the threadpool's taskprocessor
*
/*!
* \brief Create a new threadpool
*
- * This function creates a threadpool and returns a taskprocessor. Tasks pushed
- * to this taskprocessor will be handled by the threadpool and will be reported
- * on the threadpool's 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 listener The listener the threadpool will notify of changes
+ * \param initial_size The number of threads for the pool to start with
* \retval NULL Failed to create the threadpool
- * \retval non-NULL The associated taskprocessor
+ * \retval non-NULL The newly-created threadpool
*/
-struct ast_threadpool *ast_threadpool_create(struct ast_threadpool_listener *listener);
+struct ast_threadpool *ast_threadpool_create(struct ast_threadpool_listener *listener, int initial_size);
/*!
* \brief Set the number of threads for the thread pool
*/
void ast_threadpool_set_size(struct ast_threadpool *threadpool, unsigned int size);
+/*!
+ * \brief Push a task to the threadpool
+ *
+ * Tasks pushed into the threadpool will be automatically taken by
+ * one of the threads within
+ * \param pool The threadpool to add the task to
+ * \param task The task to add
+ * \param data The parameter for the task
+ * \retval 0 success
+ * \retval -1 failure
+ */
+int ast_threadpool_push(struct ast_threadpool *pool, int (*task)(void *data), void *data);
+
+/*!
+ * \brief Shut down a threadpool and destroy it
+ *
+ * \param pool The pool to shut down
+ */
+void ast_threadpool_shutdown(struct ast_threadpool *pool);
#endif /* ASTERISK_THREADPOOL_H */