Marcin 'Qrczak' Kowalczyk
26 Jul 2001 19:38:42 GMT
Thu, 26 Jul 2001 16:44:57 +0200, George Russell <firstname.lastname@example.org> pisze:
> Is there a way in Glasgow Haskell to get a thread to wait on a
> child process in the same way as the Posix function wait(), and
> get the termination status of the child?
There is no easy way: all Haskell's thread run in the same process
and wait() blocks the whole process.
The only (or the only portable) way is to call wait() with WNOHANG
repeatedly in a thread and threadDelay for a short period of time
This is what OCaml runtime does. It provides waiting for a process
as a threading primitive. It accounts for waiting in its select()
loop in the scheduler.
__("< Marcin Kowalczyk * email@example.com http://qrczak.ids.net.pl/
^^ SYGNATURA ZASTĘPCZA