From owner-freebsd-questions@FreeBSD.ORG Mon May 18 21:45:45 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 2862B106568F for ; Mon, 18 May 2009 21:45:45 +0000 (UTC) (envelope-from psteele@maxiscale.com) Received: from exprod7og111.obsmtp.com (exprod7og111.obsmtp.com [64.18.2.175]) by mx1.freebsd.org (Postfix) with SMTP id 7F3A28FC16 for ; Mon, 18 May 2009 21:45:44 +0000 (UTC) (envelope-from psteele@maxiscale.com) Received: from source ([209.85.198.235]) by exprod7ob111.postini.com ([64.18.6.12]) with SMTP ID DSNKShHXCAaMhutQdJslTZs3eDPcWX7c82oP@postini.com; Mon, 18 May 2009 14:45:44 PDT Received: by rv-out-0506.google.com with SMTP id k40so2974544rvb.51 for ; Mon, 18 May 2009 14:45:43 -0700 (PDT) Received: by 10.142.77.7 with SMTP id z7mr2238804wfa.175.1242683143832; Mon, 18 May 2009 14:45:43 -0700 (PDT) Received: from localhost ([76.231.178.131]) by mx.google.com with ESMTPS id 22sm9824712wfi.32.2009.05.18.14.45.41 (version=SSLv3 cipher=RC4-MD5); Mon, 18 May 2009 14:45:42 -0700 (PDT) Date: Mon, 18 May 2009 14:45:41 -0700 (PDT) From: Peter Steele To: Chuck Swiger Message-ID: <30551570.941242683137179.JavaMail.HALO$@halo> In-Reply-To: <8116275.921242683067831.JavaMail.HALO$@halo> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: #freebsd-questions 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: Mon, 18 May 2009 21:45:45 -0000 >The amount of stuff you're allowed to do safely in a signal handler is >pretty minimal-- you're better off setting a flag, returning from the >signal handler, and having the next run past the main event loop or >whatever check for the flag and handle things in a normal app >context. If you try to do anything involving malloc() or s/printf, >etc, you're running risks. "man sigaction" is likely to be >informative.... This is basically what we doing. When the handler is triggered we set a global variable to indicate the system is shutting down. I also signal a condition to wake up a sleeping thread. The lack of log messages indicate that this handler never gets called and the system carries on as if the kill -2 never happened.