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
This commit is contained in:
David M. Lee
2013-05-10 17:12:57 +00:00
parent db925c3f06
commit 4666079b05
16 changed files with 92 additions and 19 deletions

View File

@@ -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 */