[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Bauer, Christoph <Christoph.Bauer@l...> |
| Subject: | Unix.waitpid |
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' ()
It works mostly, but in some rare, non-deterministic cases wait loops
forever.
In a seconds round it works without problems. I saw this behaviour on Linux
and Windows. Can anybody help me?
Thanks!
Christoph Bauer
Dipl. Inf.
LMS Deutschland GmbH
Luxemburgerstr. 7
D-67657 Kaiserslautern
T +49 631 303 22 152
mailto:Christoph.Bauer@lms-gmbh.de
http://www.lmsintl.com