dect
/
asterisk
Archived
13
0
Fork 0

Merged revisions 278981 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r278981 | tilghman | 2010-07-23 11:42:25 -0500 (Fri, 23 Jul 2010) | 8 lines
  
  Avoid race with consolethread on shutdown (on parallel processors).
  
  (closes issue #17080)
   Reported by: sybasesql
   Patches: 
         20100721__issue17080.diff.txt uploaded by tilghman (license 14)
   Tested by: sybasesql
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@278982 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
tilghman 2010-07-23 16:43:34 +00:00
parent f8b73836c1
commit 8c187a70f6
1 changed files with 13 additions and 6 deletions

View File

@ -1635,14 +1635,21 @@ static void quit_handler(int num, int niceness, int safeshutdown, int restart)
ast_module_shutdown();
}
if (ast_opt_console || (ast_opt_remote && !ast_opt_exec)) {
if (getenv("HOME"))
if (getenv("HOME")) {
snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME"));
if (!ast_strlen_zero(filename))
}
if (!ast_strlen_zero(filename)) {
ast_el_write_history(filename);
if (el != NULL)
el_end(el);
if (el_hist != NULL)
history_end(el_hist);
}
if (consolethread == AST_PTHREADT_NULL || consolethread == pthread_self()) {
/* Only end if we are the consolethread, otherwise there's a race with that thread. */
if (el != NULL) {
el_end(el);
}
if (el_hist != NULL) {
history_end(el_hist);
}
}
}
if (option_verbose)
ast_verbose("Executing last minute cleanups\n");