From owner-freebsd-hackers Sat Jun 20 03:18:27 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id DAA05692 for freebsd-hackers-outgoing; Sat, 20 Jun 1998 03:18:27 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from ifi.uio.no (0@ifi.uio.no [129.240.64.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id DAA05687 for ; Sat, 20 Jun 1998 03:18:24 -0700 (PDT) (envelope-from dag-erli@ifi.uio.no) Received: from hrotti.ifi.uio.no (2602@hrotti.ifi.uio.no [129.240.64.15]) by ifi.uio.no (8.8.8/8.8.7/ifi0.2) with ESMTP id MAA17079; Sat, 20 Jun 1998 12:18:12 +0200 (MET DST) Received: (from dag-erli@localhost) by hrotti.ifi.uio.no ; Sat, 20 Jun 1998 12:18:11 +0200 (MET DST) Mime-Version: 1.0 To: smoergrd@oslo.geco-prakla.slb.com, hackers@FreeBSD.ORG Subject: Re: Signals in POSIX threads References: <199806192239.IAA22404@cimlogic.com.au> Organization: University of Oslo, Department of Informatics X-url: http://www.stud.ifi.uio.no/~dag-erli/ X-email-address-1: dag-erli@ifi.uio.no (for private or study-related mail) X-email-address-2: dagsm@hypnotech.no (for job-related mail) X-email-address-3: des@FreeBSD.org (for FreeBSD-related mail) X-email-address-4: finrod@ewox.org (for demoscene-related mail) X-disclaimer-1: I speak only for myself. The views expressed in this message X-disclaimer-2: are not those of the University of Oslo, the FreeBSD project, X-disclaimer-3: or any other organization or company to which I am or have at X-disclaimer-4: some time been affiliated. X-Stop-Spam: http://www.cauce.org/ From: dag-erli@ifi.uio.no (Dag-Erling Coidan =?iso-8859-1?Q?Sm=F8rgrav?= ) Date: 20 Jun 1998 12:09:03 +0200 In-Reply-To: John Birrell's message of "Sat, 20 Jun 1998 08:39:02 +1000 (EST)" Message-ID: Lines: 31 X-Mailer: Gnus v5.5/Emacs 19.34 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by hub.freebsd.org id DAA05688 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG John Birrell writes: > 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. What bothers me is data sharing. Since I don't know which thread will run the signal handler, I don't know if it will be necessary to protect the data it uses with a mutex or if I can access it safely. I don't much like the idea of spin-waiting on a mutex lock inside a signal handler, either. If I set all threads except the main() thread to block a specific signal (say, SIGHUP), and install a handler for it, will that ensure that it runs in the main() thread or will it just disappear down a black hole nine out of ten times? > What are you doing that _needs_ signals? Nothing that strictly *requires* signals, but since the application is intended to be long-lived¹ I was considering catching SIGHUP and rereading the configuration file (and resetting some parameters which are auto-configured) when it occurs. -- One two, one two, one two. ¹ I'm working on real-time visualization of hydrophone data onboard seismological exploration vessels. --MAA16712.898337370/ifi.uio.no-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message