diff options
author | Mark Michelson <mmichelson@digium.com> | 2013-01-15 20:48:45 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2013-01-15 20:48:45 +0000 |
commit | 663479a558e2f2b98a94a9d77cf4c66f0e66e513 (patch) | |
tree | 9116f2cfdb39354e20c909f2881c9d85d4e39d2f /main/taskprocessor.c | |
parent | 03e89247ded06b5320684bfa10a6e5e2fbe57646 (diff) |
Make ast_taskprocessor_listener opaque.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379125 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/taskprocessor.c')
-rw-r--r-- | main/taskprocessor.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/main/taskprocessor.c b/main/taskprocessor.c index fae93967a..0b6a2a817 100644 --- a/main/taskprocessor.c +++ b/main/taskprocessor.c @@ -78,6 +78,26 @@ struct ast_taskprocessor { /*! Indicates if the taskprocessor is in the process of shuting down */ unsigned int shutting_down:1; }; + +/*! + * \brief A listener for taskprocessors + * + * \since 12.0.0 + * + * When a taskprocessor's state changes, the listener + * is notified of the change. This allows for tasks + * to be addressed in whatever way is appropriate for + * the module using the taskprocessor. + */ +struct ast_taskprocessor_listener { + /*! The callbacks the taskprocessor calls into to notify of state changes */ + const struct ast_taskprocessor_listener_callbacks *callbacks; + /*! The taskprocessor that the listener is listening to */ + struct ast_taskprocessor *tps; + /*! Data private to the listener */ + void *user_data; +}; + #define TPS_MAX_BUCKETS 7 /*! \brief tps_singletons is the astobj2 container for taskprocessor singletons */ static struct ao2_container *tps_singletons; @@ -473,6 +493,16 @@ struct ast_taskprocessor_listener *ast_taskprocessor_listener_alloc(const struct return listener; } +struct ast_taskprocessor *ast_taskprocessor_listener_get_tps(const struct ast_taskprocessor_listener *listener) +{ + return listener->tps; +} + +void *ast_taskprocessor_listener_get_user_data(const struct ast_taskprocessor_listener *listener) +{ + return listener->user_data; +} + static void *default_listener_pvt_alloc(void) { struct default_taskprocessor_listener_pvt *pvt; |