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
AW: [Caml-list] Unix.waitpid
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Bauer, Christoph <Christoph.Bauer@l...>
Subject: AW: [Caml-list] Unix.waitpid

> Well, using the corresponding C-API-function,
> you should better rename your arguments:
>   wpid is the pid you wait for (the argument to Unix.waitpid)  and
>    pid is the value you get from that function:
> ===== from the wait(2)/waitpid(2)-manpage =============
>      pid_t
>      waitpid(pid_t wpid, int *status, int options);
> =======================================================


> BTW: where do you set the "pid" initially?

>From a Unix.create_process call.

> And: if waitpid returns with a pid, then you can't wait on this
> pid/process again. So, if you wait for one pid and get a different
> pid as result of the function call, then you wait again.
> But if you another time waits for a pid, which you alread caught
> (got as a result once before), then you can wait infinite,
> because that pid was caught by waitpud before... and you have to
> wait until the pid is reused by the kernel or wait until next 
> reboot. ;-)

Ok, then I'll use pid = 0 (or wpid = 0, after the renaming) to terminate
the loop. 

Thanks for the replies,
Christoph Bauer