Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Mar 2005 11:56:22 -0800 (PST)
From:      Dirk-Willem van Gulik <dirkx@webweaving.org>
To:        zean zean <fbsd.hackers@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: the best form to wait the finish of execution of a child...
Message-ID:  <20050330115132.N76928@skutsje.san.webweaving.org>
In-Reply-To: <a9e342b5050330101771e53d6f@mail.gmail.com>
References:  <a9e342b5050330101771e53d6f@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On Wed, 30 Mar 2005, zean zean wrote:

> while(childpid != wait(&status))
> Any aid to obtain the best way is very welcome.

If you are waiting for a specific child temrimatingin see 'waitpid(); (or
wait4() - "man wait4") -- that safes you the while() loop. It allows you
to listen for just the child you want.

If you just want to -know- if a child dies but simply allow your program
to continue then install a signal handler on SIGCHLD.

The best book I personally found is to get is "Advanced Programming in the
UNIX Environment" by Richard Stevens.

Dw



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050330115132.N76928>