From: Jonathan Rose Date: Thu, 5 Jan 2012 15:25:29 +0000 (+0000) Subject: Ensures Asterisk closes when receiving terminal signals in 'no fork' mode. X-Git-Tag: 1.8.10.0-rc1~78 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=879208db8e92b2740dbd5f03beaead8a3e184e65;p=thirdparty%2Fasterisk.git Ensures Asterisk closes when receiving terminal signals in 'no fork' mode. 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) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@349672 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/asterisk.c b/main/asterisk.c index b54ab03cad..8658f7ee02 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -3098,7 +3098,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 {