#define _ASTERISK__PRIVATE_H
int load_modules(unsigned int); /*!< Provided by loader.c */
+int modules_shutdown(void); /*!< Provided by loader.c */
int load_pbx(void); /*!< Provided by pbx.c */
int load_pbx_builtins(void); /*!< Provided by pbx_builtins.c */
int load_pbx_functions_cli(void); /*!< Provided by pbx_functions.c */
*/
int ast_loader_unregister(int (*updater)(void));
-/*!
- * \brief Run the unload() callback for all loaded modules
- *
- * This function should be called when Asterisk is shutting down gracefully.
- */
-void ast_module_shutdown(void);
-
/*!
* \brief Match modules names for the Asterisk cli.
* \param line Unused by this function, but this should be the line we are
struct ast_json *json_object = NULL;
int run_cleanups = niceness >= SHUTDOWN_NICE;
- if (run_cleanups) {
- ast_module_shutdown();
+ if (run_cleanups && modules_shutdown()) {
+ ast_verb(0, "Some modules could not be unloaded, switching to fast shutdown\n");
+ run_cleanups = 0;
}
if (!restart) {
#endif
-void ast_module_shutdown(void)
+int modules_shutdown(void)
{
struct ast_module *mod;
int somethingchanged = 1, final = 0;
}
} while (somethingchanged && !final);
+ final = AST_DLLIST_EMPTY(&module_list);
AST_DLLIST_UNLOCK(&module_list);
+
+ return !final;
}
int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode force)