Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <20001101201818.7122.qmail@web1306.mail.yahoo.com> Date: Wed, 1 Nov 2000 12:18:18 -0800 (PST) From: Robert Fidler Subject: Re: 1.1.4, select, and SIGCHLD To: cygwin AT sources DOT redhat DOT com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > From: uunet!sources.redhat.com!cygwin-owner > [mailto:uunet!sources.redhat.com!cygwin-owner]On Behalf Of Christopher > Faylor > Sent: Wednesday, November 01, 2000 1:46 PM > To: uunet!sources.redhat.com!cygwin > Subject: Re: 1.1.4, select, and SIGCHLD > > > On Wed, Nov 01, 2000 at 08:52:36AM -0800, Robert Fidler wrote: > >I am seeing behavior where a daemon process has multiple children die > >'simultaneously' and subsequent calls to select() consistently return > >-1 immediately with errno set to EINTR. This puts the daemon into a > >tight spinloop and it becomes useless. If the child deaths are > >sequential, the daemon behaves properly. > > > >I've seen this behavior on cygwin 1.1.4 and 1.1.5-2. Has anyone else > >seen this behavior and is there a fix for it? > > No, and no. > > cgf > Below is a test program that exhibits the behavior I described. By defining WORKS, you will add a 1 second sleep between the kills and the program will work as expected. Robert #include #include #include #include #define NCHILDREN 10 void die(int sig) { printf("child exiting\n"); exit(0); } void reaper(int sig) { int pid, status; printf("reaping processes...\n"); while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { printf("reaping process %d that exited with status %d\n", status); } } int main(int argc, char **argv) { int i; int childpid[NCHILDREN]; struct sigaction saction; saction.sa_handler=die; saction.sa_mask=0; saction.sa_flags=0; sigaction(SIGTERM, &saction, NULL); /* * Fork off children that do nothing but sleep. */ for (i=0; i