From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA01527; Fri, 24 Aug 2001 15:47:21 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA01312 for ; Fri, 24 Aug 2001 15:47:21 +0200 (MET DST) Received: from moutvdom00.kundenserver.de (moutvdom00.kundenserver.de [195.20.224.149]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f7ODlJn23083 for ; Fri, 24 Aug 2001 15:47:19 +0200 (MET DST) Received: from [195.20.224.208] (helo=mrvdom01.schlund.de) by moutvdom00.kundenserver.de with esmtp (Exim 2.12 #2) id 15aHIn-0003On-00; Fri, 24 Aug 2001 15:47:13 +0200 Received: from drms-3e36539e.pool.mediaways.net ([62.54.83.158] helo=ice.gerd-stolpmann.de) by mrvdom01.schlund.de with esmtp (Exim 2.12 #2) id 15aHIm-0005aZ-00; Fri, 24 Aug 2001 15:47:12 +0200 Received: from localhost (localhost [[UNIX: localhost]]) by ice.gerd-stolpmann.de (8.9.3/8.9.3) id PAA16407; Fri, 24 Aug 2001 15:46:38 +0200 From: Gerd Stolpmann Reply-To: info@gerd-stolpmann.de Organization: privat To: Berke Durak , caml-list@inria.fr Subject: Re: [Caml-list] How to use both select and waitpid ? Date: Fri, 24 Aug 2001 15:32:45 +0200 X-Mailer: KMail [version 1.0.28] Content-Type: text/plain References: <20010824144135.C27538@localhost.localdomain> In-Reply-To: <20010824144135.C27538@localhost.localdomain> MIME-Version: 1.0 Message-Id: <01082415463809.02716@ice> Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 24 Aug 2001, Berke Durak wrote: >Ok it's not absolutely Caml-specific, but here's my problem. > >I'm doing a sort of network server that forks some children and >processes their output. So I need to do asynchronous I/O on sockets >(which implies use of Unix.select) but I also need to waitpid for >children. How do I do this ? I was hoping that select would return >with EINTR on receipt of SIGCHLD, but this isn't the case (even if >I've unblocked the signal and set its handler to something). Could >some Unix guru explain me this ? Thanks a lot. For operating systems with POSIX signals, it should work. You need an (empty) SIGCHLD signal handler. For other operating systems, things may be different. Historically, the BSD systems automatically restarted system calls instead of reporting EINTR, and you needed to set a flag to avoid that. However, current BSD systems base on POSIX signals, too, and restarting does not happen. The caml runtime tries to find out whether POSIX signals are available, and uses them if possible. If not, it falls back to ANSI-C signals which don't specify what to do. So your problem depends on the OS, and on whether the caml runtime thinks that POSIX signals are available or not. You can check the latter by looking into config/s.h (after calling "configure" on the caml sources) and checking whether POSIX_SIGNALS is defined. Gerd -- ---------------------------------------------------------------------------- Gerd Stolpmann Telefon: +49 6151 997705 (privat) Viktoriastr. 45 64293 Darmstadt EMail: gerd@gerd-stolpmann.de Germany ---------------------------------------------------------------------------- ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr