Date: Tue, 5 Feb 2002 15:02:08 +1100 (EST) From: callum.gibson@db.com To: eischen@pcnet1.pcnet.com Cc: hackers@FreeBSD.ORG Subject: Re: pthread_sigmask problem Message-ID: <20020205040208.75763.qmail@merton.aus.deuba.com> In-Reply-To: <Pine.GSO.4.10.10202042229360.23662-100000@pcnet1.pcnet.com> from "eischen@pcnet1.pcnet.com" at Feb 04, 2002 10:40:23 PM
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020205040208.75763.qmail>