caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Oliver Bandel <oliver@first.in-berlin.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Unix.waitpid
Date: Thu, 30 Jun 2005 14:35:01 +0200	[thread overview]
Message-ID: <20050630123501.GB321@first.in-berlin.de> (raw)
In-Reply-To: <26EB47FDD566A7469FC862DAF373792F07D4DA@kaiserslautern1.lmsintl.com>

On Thu, Jun 30, 2005 at 02:09:51PM +0200, Bauer, Christoph wrote:
> Hi,
> 
> my app should wait for some processes. This is done 
> by my function wait, which gets a pid, a idle function (e.g. ignore)
> + its value and a delay time between polling:
> 
> 
> let delay s = ignore (Unix.select [] [] [] s)
> 
> let wait ?(delay_time = 0.01) pid idle x =
>   let rec wait' () =
>     idle x;
>     delay delay_time;
>     let pid = try fst (Unix.waitpid [Unix.WNOHANG] pid) with _  -> 1 in
>       if pid <> 0 then wait' ()
>   in wait' ()

Does you have a valid pid (as calling parameter)?
You may better use 0 or -1 in the call to Unix.waitpid.

Maybe WUNTRACED would also makes sense as flag.
Maybe better not testing with "_" in try-with.


P.S.: Documentation could be better.
I had to look in the C-API manpage to know what parameters
the Unix.aitpid awaits.
That the one arg is the pid is mentioned in the documentation, but there
is no function call example, to identify the second arg as the wpid.


Ciao,
   Oliver Bandel


  reply	other threads:[~2005-06-30 12:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-30 12:09 Unix.waitpid Bauer, Christoph
2005-06-30 12:35 ` Oliver Bandel [this message]
2005-06-30 12:31 AW: [Caml-list] Unix.waitpid Bauer, Christoph
2005-06-30 12:44 ` Oliver Bandel

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=20050630123501.GB321@first.in-berlin.de \
    --to=oliver@first.in-berlin.de \
    --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).