From owner-freebsd-threads@FreeBSD.ORG Fri Jun 11 04:37:21 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C327216A4CE for ; Fri, 11 Jun 2004 04:37:21 +0000 (GMT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 83C8243D46 for ; Fri, 11 Jun 2004 04:37:21 +0000 (GMT) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id i5B4bG6x001697; Fri, 11 Jun 2004 00:37:18 -0400 (EDT) Date: Fri, 11 Jun 2004 00:37:16 -0400 (EDT) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Sean McNeil In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-threads@freebsd.org Subject: Re: signal handler priority issue X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jun 2004 04:37:21 -0000 On Fri, 11 Jun 2004, Daniel Eischen wrote: > > It doesn't matter. If a signal is sent to a thread (via pthread_kill()) > and that signal is masked, then the signal is added to the thread's > pending signals. If it hits sigsuspend() at a later point in time > and any pending signals are unmasked, then it returns after processing > those pending signals. Also be sure that the installed signal action mask is set to mask out SIGUSR2. static void sigusr1_handler(int sig, siginfo_t *info, ucontext_t *ucp) { sigset_t mask; pthread_sigmask(SIG_SETMASK, NULL, &mask); assert(sigismember(&mask, SIGUSR2) != 0); sem_post(...); sigdelset(&mask, SIGUSR2); sigsuspend(&mask); } Also I think you need a handler for SIGUSR2 as well as SIGUSR1. The default action for both SIGUSR1 and SIGUSR2 is to terminate the process. You can't set it to SIG_IGN either because that will prevent the thread from receiving the signal. -- Dan Eischen