caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: Berke Durak <berke@altern.org>, caml-list@inria.fr
Subject: Re: [Caml-list] How to use both select and waitpid ?
Date: Fri, 24 Aug 2001 15:32:45 +0200	[thread overview]
Message-ID: <01082415463809.02716@ice> (raw)
In-Reply-To: <20010824144135.C27538@localhost.localdomain>

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


  reply	other threads:[~2001-08-24 13:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-24 12:41 Berke Durak
2001-08-24 13:32 ` Gerd Stolpmann [this message]
2001-08-25 12:53   ` [Caml-list] " Berke Durak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01082415463809.02716@ice \
    --to=info@gerd-stolpmann.de \
    --cc=berke@altern.org \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).