Date: Tue, 09 Jul 1996 20:43:34 +0100 From: "Gary Palmer" <gpalmer@FreeBSD.ORG> To: Brandon Gillespie <brandon@tombstone.sunrem.com> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: handling SIGCHLD with multiple children Message-ID: <28681.836941414@palmer.demon.co.uk> In-Reply-To: Your message of "Tue, 09 Jul 1996 13:21:06 MDT." <Pine.BSF.3.91.960709131511.4876B-100000@tombstone.sunrem.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Brandon Gillespie wrote in message ID
<Pine.BSF.3.91.960709131511.4876B-100000@tombstone.sunrem.com>:
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?28681.836941414>
