mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-12 12:58:30 +00:00
Genericize the allocation and destruction of taskprocessor listeners.
The goal of this is to take the responsibility away from individual listeners to be sure to properly unref the taskprocessor. git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376121 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -63,10 +63,14 @@ enum ast_tps_options {
|
||||
struct ast_taskprocessor_listener;
|
||||
|
||||
struct ast_taskprocessor_listener_callbacks {
|
||||
/*! Allocate the listener's private data */
|
||||
void *(*alloc)(struct ast_taskprocessor_listener *listener);
|
||||
/*! Indicates a task was pushed to the processor */
|
||||
void (*task_pushed)(struct ast_taskprocessor_listener *listener, int was_empty);
|
||||
/*! Indicates the task processor has become empty */
|
||||
void (*emptied)(struct ast_taskprocessor_listener *listener);
|
||||
/*! Destroy the listener's private data */
|
||||
void (*destroy)(void *private_data);
|
||||
};
|
||||
|
||||
struct ast_taskprocessor_listener {
|
||||
@@ -75,6 +79,9 @@ struct ast_taskprocessor_listener {
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
struct ast_taskprocessor_listener *ast_taskprocessor_listener_alloc(struct ast_taskprocessor *tps,
|
||||
struct ast_taskprocessor_listener_callbacks *callbacks);
|
||||
|
||||
/*!
|
||||
* \brief Get a reference to a taskprocessor with the specified name and create the taskprocessor if necessary
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user