From owner-freebsd-questions@FreeBSD.ORG Tue May 19 00:32:48 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DB59106566B for ; Tue, 19 May 2009 00:32:48 +0000 (UTC) (envelope-from psteele@maxiscale.com) Received: from exprod7og125.obsmtp.com (exprod7og125.obsmtp.com [64.18.2.28]) by mx1.freebsd.org (Postfix) with SMTP id DF1B38FC0A for ; Tue, 19 May 2009 00:32:47 +0000 (UTC) (envelope-from psteele@maxiscale.com) Received: from source ([209.85.222.106]) by exprod7ob125.postini.com ([64.18.6.12]) with SMTP ID DSNKShH+L5VhuRP7eHYzZzqSJbwQQxyVvrBH@postini.com; Mon, 18 May 2009 17:32:48 PDT Received: by pzk4 with SMTP id 4so2160127pzk.7 for ; Mon, 18 May 2009 17:32:47 -0700 (PDT) Received: by 10.115.50.5 with SMTP id c5mr12535050wak.7.1242693167190; Mon, 18 May 2009 17:32:47 -0700 (PDT) Received: from localhost ([76.231.178.131]) by mx.google.com with ESMTPS id j15sm5962261waf.64.2009.05.18.17.32.45 (version=SSLv3 cipher=RC4-MD5); Mon, 18 May 2009 17:32:46 -0700 (PDT) Date: Mon, 18 May 2009 17:32:45 -0700 (PDT) From: Peter Steele To: #freebsd-questions Message-ID: <25097232.1021242693162151.JavaMail.HALO$@halo> In-Reply-To: <70C0964126D66F458E688618E1CD008A0793ED2E@WADPEXV0.waddell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: Why would a kill -2 not work? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 May 2009 00:32:48 -0000 >You're not trying to send a signal within the signal handler itself, >are you? That won't work-- signal delivery is blocked when you're >already running in a signal handler. Also, note that trying to mix >signals with a multithreaded process is complicated.... No, I'm not sending a signal within a signal. The signal handler is this: pthread_mutex_lock(&keep_running_mutex); KEEP_RUNNING = 0; pthread_cond_signal(&keep_running_cond); pthread_mutex_unlock(&keep_running_mutex); This works fine, but at some point it seems to stop working. The app just continues to run as if it never received the -2 signal. We have to use a kill -9 to kill it, which we want to avoid because this prevents our shutdown code from executing.