From owner-freebsd-hackers Thu Feb 5 16:03:08 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA29760 for hackers-outgoing; Thu, 5 Feb 1998 16:03:08 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from dingo.cdrom.com (lapdog.cdrom.com [204.216.28.145]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA29716 for ; Thu, 5 Feb 1998 16:02:59 -0800 (PST) (envelope-from mike@word.smith.net.au) Received: from word (localhost [127.0.0.1]) by word.smith.net.au (8.8.8/8.8.5) with ESMTP id VAA00292; Thu, 5 Feb 1998 21:48:42 +1030 (CST) Message-Id: <199802051118.VAA00292@word.smith.net.au> X-Mailer: exmh version 2.0zeta 7/24/97 To: Graham Wheeler cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Shared memory and signals In-reply-to: Your message of "Sat, 02 Feb 1998 17:41:35 +0200." <199802021541.RAA07701@cdsec.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 05 Feb 1998 21:48:42 +1030 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe hackers" > I was wondering whether it is safe to call shmdt and shmctl from within > a signal handler. I have a program which forks off child processes which > communicate their results back using a shared memory segment. I would like > the parent to detach and release the shared memory from within the SIGCHLD > signal handler, but I'm not sure whether this is safe. Can you do this more cleanly by calling wait4? Unless you are sleeping on something inside the segment, I can't *think* of any reentrancy/ locking issues, but I would be worried about the locking you'd have to apply around the other datastructures that your handler might be accessing. -- \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\