[Asterisk-Dev] Incomplete implementation of ast_run_atexits
Michael Sandee
ms at zeelandnet.nl
Sun Jul 4 06:39:36 MST 2004
The registered atexit calls I talked about in my previous mail are not
being called when a certain module doesn't load properly... such as
chan_zap when ztcfg hasn't been run yet...
res_musiconhold.so registers an atexit to stop remaining mpg123
instances it started. It doesn't when the before mentioned chan_zap
module doesn't load and Asterisk stops. This results in mpg123 processes
floating around the system... Other already loaded modules that use the
atexit functions (none in Asterisk at this point) will not exit properly
either.
My idea is to call ast_run_atexits() before exit() is called in the
main(). If there are any other exit() places, apart from where we
fork(), we might need to add it there aswell... but I think there are
none. Only modules would use atexit, so I run it only on exit()'s called
after load_modules() is being called.
I am awaiting your comments.
Something like:
diff -Naur -X exclude-files asterisk-orig/asterisk.c asterisk/asterisk.c
--- asterisk-orig/asterisk.c 2004-07-04 17:29:44.185726296 +0200
+++ asterisk/asterisk.c 2004-07-04 17:03:44.000000000 +0200
@@ -1483,18 +1483,30 @@
exit(1);
}
if (load_modules()) {
+ if (option_verbose)
+ ast_verbose("Executing last minute cleanups\n");
+ ast_run_atexits();
printf(term_quit());
exit(1);
}
if (init_framer()) {
+ if (option_verbose)
+ ast_verbose("Executing last minute cleanups\n");
+ ast_run_atexits();
printf(term_quit());
exit(1);
}
if (astdb_init()) {
+ if (option_verbose)
+ ast_verbose("Executing last minute cleanups\n");
+ ast_run_atexits();
printf(term_quit());
exit(1);
}
if (ast_enum_init()) {
+ if (option_verbose)
+ ast_verbose("Executing last minute cleanups\n");
+ ast_run_atexits();
printf(term_quit());
exit(1);
}
Michael
More information about the asterisk-dev
mailing list