summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2018-01-04 07:12:43 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2018-01-04 07:12:43 -0600
commit2fac32a37adbe92922212e17f2989cf1b0333832 (patch)
treebc99fa2c3a60f19f0684ae1a89eae82e611f22c6 /include
parent25399f74aab21c47d12e5abda4df0998787d16fe (diff)
parent55f1d69c43d2c6c87eec50fd3eed7a77ba2e912b (diff)
Merge "loader: Create ast_module_running_ref."
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/module.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/asterisk/module.h b/include/asterisk/module.h
index d3b9ddc20..103cd3053 100644
--- a/include/asterisk/module.h
+++ b/include/asterisk/module.h
@@ -357,6 +357,7 @@ void __ast_module_user_hangup_all(struct ast_module *);
#define ast_module_user_hangup_all() __ast_module_user_hangup_all(AST_MODULE_SELF)
struct ast_module *__ast_module_ref(struct ast_module *mod, const char *file, int line, const char *func);
+struct ast_module *__ast_module_running_ref(struct ast_module *mod, const char *file, int line, const char *func);
void __ast_module_shutdown_ref(struct ast_module *mod, const char *file, int line, const char *func);
void __ast_module_unref(struct ast_module *mod, const char *file, int line, const char *func);
@@ -369,6 +370,20 @@ void __ast_module_unref(struct ast_module *mod, const char *file, int line, cons
* from being unloaded.
*/
#define ast_module_ref(mod) __ast_module_ref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+
+/*!
+ * \brief Hold a reference to the module if it is running.
+ * \param mod Module to reference
+ * \retval mod if running
+ * \retval NULL if not running
+ *
+ * The returned pointer should be released with ast_module_unref.
+ *
+ * \note A module reference will prevent the module from being unloaded.
+ */
+#define ast_module_running_ref(mod) \
+ __ast_module_running_ref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+
/*!
* \brief Prevent unload of the module before shutdown
* \param mod Module to hold