From owner-freebsd-hackers Mon Feb 4 20: 2:17 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from imr1.aus.deuba.com (bagheera.aus.deuba.com [203.0.62.7]) by hub.freebsd.org (Postfix) with ESMTP id 02A0A37B41E for ; Mon, 4 Feb 2002 20:02:12 -0800 (PST) Received: from bmr1-e1.aus.deuba.com by imr1.aus.deuba.com id g1542AP04348; Tue, 5 Feb 2002 15:02:10 +1100 (EST) Received: from mailhost.aus.deuba.com [10.179.4.6] by bmr1-e1.aus.deuba.com id g15429n11413; Tue, 5 Feb 2002 15:02:09 +1100 (EST) Received: from merton.aus.deuba.com (merton.aus.deuba.com [10.179.88.22]) by mailhost.aus.deuba.com (8.9.1/8.9.1) with SMTP id PAA28628 for ; Tue, 5 Feb 2002 15:02:09 +1100 (EST) Received: (qmail 75764 invoked by uid 107); 5 Feb 2002 04:02:08 -0000 Message-ID: <20020205040208.75763.qmail@merton.aus.deuba.com> From: callum.gibson@db.com Subject: Re: pthread_sigmask problem To: eischen@pcnet1.pcnet.com Date: Tue, 5 Feb 2002 15:02:08 +1100 (EST) Cc: hackers@FreeBSD.ORG In-Reply-To: from "eischen@pcnet1.pcnet.com" at Feb 04, 2002 10:40:23 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thanks, Dan. (I saw your name come up in the archives next to a lot of threads/signals posts while I was looking for an answer to this so I wondered if you'd answer. :-) eischen@pcnet1.pcnet.com writes: }> However, it seems that signals such as SIGPIPE, SIGINT, etc will still }> kill the process. I also tried replacing the pthread_sigmask call with }> sigprocmask to see if it made any difference, which it didn't. }Yes, at least with FreeBSD pthreads you have to either install a signal }handler to catch these signals or to set the handler to SIG_IGN. When }you set a threads signal mask, even if it is for all threads, you don't }affect how signals are delivered to the process. The default action }for SIGPIPE and SIGINT is to kill the process, so setting masks for }threads doesn't affect this. I figured it was just using the default action for these signals. So, am I mistaken in thinking that SIG_BLOCK was supposed to ignore those signals or is this a pthreads bug on FreeBSD? Or just an "undefined" behaviour and a pthreads gotcha? It's worth noting that even with pthreads on Solaris I get the behaviour I was expecting (ie the signals are ignored) using either pthread_sigmask or sigprocmask. Also, is it documented anywhere which signals will behave like this? It seems like it would be all of them, as if the process still has an inherent signal mask independent of the threads running, thus requiring signal handlers to be installed for them. Hmm, it's a lot more verbose calling sigaction for every signal rather than a single pthread_sigmask call. I guess that's why we have for loops. C (c)2002 Callum Gibson callum.gibson@db.com Global Markets IT, Deutsche Bank, Australia 61 2 9258 1620 ### The opinions in this message are mine and not Deutsche's ### To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message