Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] How to use both select and waitpid ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-08-24 (13:47)
From: Gerd Stolpmann <info@g...>
Subject: Re: [Caml-list] How to use both select and waitpid ?
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 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 Stolpmann      Telefon: +49 6151 997705 (privat)
Viktoriastr. 45             
64293 Darmstadt     EMail:
Bug reports:  FAQ:
To unsubscribe, mail  Archives: