diff options
Diffstat (limited to 'include/asterisk/stasis.h')
-rw-r--r-- | include/asterisk/stasis.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/asterisk/stasis.h b/include/asterisk/stasis.h index 4189513ac..0b1b1e83f 100644 --- a/include/asterisk/stasis.h +++ b/include/asterisk/stasis.h @@ -542,6 +542,31 @@ struct stasis_subscription *stasis_subscribe(struct stasis_topic *topic, stasis_subscription_cb callback, void *data); /*! + * \brief Create a subscription whose callbacks occur on a thread pool + * + * In addition to being AO2 managed memory (requiring an ao2_cleanup() to free + * up this reference), the subscription must be explicitly unsubscribed from its + * topic using stasis_unsubscribe(). + * + * The invocations of the callback are serialized, but will almost certainly not + * always happen on the same thread. The invocation order of different subscriptions + * is unspecified. + * + * Unlike \ref stasis_subscribe, this function will explicitly use a threadpool to + * dispatch items to its \c callback. This form of subscription should be used + * when many subscriptions may be made to the specified \c topic. + * + * \param topic Topic to subscribe to. + * \param callback Callback function for subscription messages. + * \param data Data to be passed to the callback, in addition to the message. + * \return New \ref stasis_subscription object. + * \return \c NULL on error. + * \since 12.8.0 + */ +struct stasis_subscription *stasis_subscribe_pool(struct stasis_topic *topic, + stasis_subscription_cb callback, void *data); + +/*! * \brief Cancel a subscription. * * Note that in an asynchronous system, there may still be messages queued or |