From owner-freebsd-hackers Fri Jun 19 15:32:30 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA21050 for freebsd-hackers-outgoing; Fri, 19 Jun 1998 15:32:30 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from cimlogic.com.au (cimlog.lnk.telstra.net [139.130.51.31]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA20974 for ; Fri, 19 Jun 1998 15:32:18 -0700 (PDT) (envelope-from jb@cimlogic.com.au) Received: (from jb@localhost) by cimlogic.com.au (8.8.8/8.8.7) id IAA22404; Sat, 20 Jun 1998 08:39:02 +1000 (EST) (envelope-from jb) From: John Birrell Message-Id: <199806192239.IAA22404@cimlogic.com.au> Subject: Re: Signals in POSIX threads In-Reply-To: from =?ISO-8859-1?Q?Dag=2DErling_Coidan_Sm=F8rgrav?= at "Jun 19, 98 02:02:23 pm" To: smoergrd@oslo.geco-prakla.slb.com (Dag-Erling Coidan Smørgrav) Date: Sat, 20 Jun 1998 08:39:02 +1000 (EST) Cc: hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL40 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Dag-Erling Coidan Smørgrav wrote: > This is not strictly FreeBSD-related, but I thought I'd ask here since > many of you are probably working with pthreads at some level. > > Is there any way to force all (or specific) signals sent to a process > to be sent to a particular thread? The behaviour I'm seeing now¹ is > that the signal is going to a seemingly random thread². Wether the > signal handler is being installed before or after the threads are > started doesn't seem to make a difference. > > I asked a colleague at Geco about it, and his answer was "Whatever you > want to do, find a way to do it that doesn't involve signals." Not > very helpful :) POSIX threaded processes only have one set of signal handlers but a thread specific signal mask. POSIX says that "at the time of generation, a determination shall be made whether the signal has been generated for the process or for a specific thread within the process". But without each thread being able to choose a signal handler, it is not really very useful. I'd agree with your colleague. 8-) It is best to write threaded applications to work in the presence of signals, but to avoid using them for anything thread specific. What are you doing that _needs_ signals? -- John Birrell - jb@cimlogic.com.au; jb@freebsd.org http://www.cimlogic.com.au/ CIMlogic Pty Ltd, GPO Box 117A, Melbourne Vic 3001, Australia +61 418 353 137 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message