summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2013-05-10 17:12:57 +0000
committerDavid M. Lee <dlee@digium.com>2013-05-10 17:12:57 +0000
commit4666079b05ea3b189e4fdccc665f7a61bf3e5535 (patch)
tree826e54b6a78671d7e911cbff4799b31b0aed9a30 /include
parentdb925c3f066fc73849af06bcfc966467af349891 (diff)
Address unload order issues for res_stasis* modules
I've noticed when doing a graceful shutdown that the res_stasis_http.so module gets unloaded before the modules that use it, which causes some asserts during their unload. While r386928 was a quick hack to get it to not assert and die, this patch increases the use counts on res_stasis.so and res_stasis_http.so properly. It's a bigger change than I expected, hence the review instead of just committing it. Review: https://reviewboard.asterisk.org/r/2489/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/stasis_app.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/asterisk/stasis_app.h b/include/asterisk/stasis_app.h
index a789e4012..00d8f705f 100644
--- a/include/asterisk/stasis_app.h
+++ b/include/asterisk/stasis_app.h
@@ -44,6 +44,10 @@
* Finally, Stasis apps control channels through the use of the \ref
* stasis_app_control object, and the family of \c stasis_app_control_*
* functions.
+ *
+ * Since module unload order is based on reference counting, any module that
+ * uses the API defined in this file must call stasis_app_ref() when loaded,
+ * and stasis_app_unref() when unloaded.
*/
#include "asterisk/channel.h"
@@ -171,6 +175,20 @@ int stasis_app_control_answer(struct stasis_app_control *control);
*/
struct ast_json *ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot);
+/*!
+ * \brief Increment the res_stasis reference count.
+ *
+ * This ensures graceful shutdown happens in the proper order.
+ */
+void stasis_app_ref(void);
+
+/*!
+ * \brief Decrement the res_stasis reference count.
+ *
+ * This ensures graceful shutdown happens in the proper order.
+ */
+void stasis_app_unref(void);
+
/*! @} */
#endif /* _ASTERISK_STASIS_APP_H */