From owner-freebsd-hackers Tue Jul 9 12:44:02 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id MAA01213 for hackers-outgoing; Tue, 9 Jul 1996 12:44:02 -0700 (PDT) Received: from palmer.demon.co.uk (palmer.demon.co.uk [158.152.50.150]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id MAA01170 for ; Tue, 9 Jul 1996 12:43:52 -0700 (PDT) Received: from palmer.demon.co.uk (localhost [127.0.0.1]) by palmer.demon.co.uk (sendmail/PALMER-2) with ESMTP id UAA28683; Tue, 9 Jul 1996 20:43:36 +0100 (BST) To: Brandon Gillespie cc: freebsd-hackers@FreeBSD.ORG From: "Gary Palmer" Subject: Re: handling SIGCHLD with multiple children In-reply-to: Your message of "Tue, 09 Jul 1996 13:21:06 MDT." Date: Tue, 09 Jul 1996 20:43:34 +0100 Message-ID: <28681.836941414@palmer.demon.co.uk> Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Brandon Gillespie wrote in message ID : > The server is a object oriented database driver (with its own interpreted > language), and the child is handling a backup pseudo-asyncrynously. > Basically it syncronizes its database on disk, sets it read-only and forks > a child which begins the actual backup. When the child is finished > copying the server knows to go back to a read/write db when it receives > the signal. However, there is also the possibility of other children with > different purposes being forked as well. Furthermore, the server is > handling network connections, and does NOT want to block while it backups, > due to the time involved with a sizeable database. I suppose I could just > use one of the SIGUSR* signals.. Why not go with my second suggestion? You can trap the SIGCHLD, and in the handler do something like: void sig_child(int dummy) { int status; if (waitpid(backup_pid, &status, WNOHANG) == backup_pid) db_rw = TRUE; } This is rough code, written on the fly, and I suggest you read the wait() manpage for more details. Gary -- Gary Palmer FreeBSD Core Team Member FreeBSD: Turning PC's into workstations. See http://www.FreeBSD.ORG/ for info