]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Ensures Asterisk closes when receiving terminal signals in 'no fork' mode.
authorJonathan Rose <jrose@digium.com>
Thu, 5 Jan 2012 16:07:05 +0000 (16:07 +0000)
committerJonathan Rose <jrose@digium.com>
Thu, 5 Jan 2012 16:07:05 +0000 (16:07 +0000)
When catching a signal, in no fork mode the console thread is identical to the thread
responsible for catching the signal and closing Asterisk, which requires it to first
dispense with the console thread. Prior to this patch, if these threads were identical,
upon receiving a killing signal, the thread will send an URG signal to itself, which
we also catch and then promptly do nothing with. Obviously this isn't useful behavior.

(closes issue ASTERISK-19127)
Reported By: Bryon Clark
Patches:
quit_on_signals.patch uploaded by Bryon Clark (license 6157)
........

Merged revisions 349672 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@349673 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/asterisk.c

index e6403fa4f1ce52f7c2debe04e1fcae49d36cb8c2..9d1f8206dc4e43ea7c5e7e8d0dd824470941369a 100644 (file)
@@ -3126,7 +3126,7 @@ static void *monitor_sig_flags(void *unused)
                }
                if (sig_flags.need_quit) {
                        sig_flags.need_quit = 0;
-                       if (consolethread != AST_PTHREADT_NULL) {
+                       if ((consolethread != AST_PTHREADT_NULL) && (consolethread != pthread_self())) {
                                sig_flags.need_quit_handler = 1;
                                pthread_kill(consolethread, SIGURG);
                        } else {