Plasma GitLab Archive
Projects Blog Knowledge

Class Uq_engines.poll_process_engine


class poll_process_engine : ?period:float -> pid:int -> Unixqueue.event_system -> [Unix.process_status] engine
This engine waits until the process with the ID pid terminates. When this happens, the state of the engine changes to `Done, and the argument of `Done is the process status.

The engine does not catch stopped processes.

The engine checks the process status every period seconds, and whenever there is a Signal event on the queue. The idea of the latter is that the user of this engine can increase the responsiveness by defining a signal handler for SIGCHLD signals (the handler need not to perform any special action, it must just be defined). When the sub process terminates, a SIGCHLD signal is sent to the current process. If the event loop happens to wait for new conditions (which is usually very likely), a Signal event will be generated, and the engine will check the process status very soon. Note that it is not guaranteed that a terminating process triggers a Signal event, although it is very likely.

You can define an empty SIGCHLD handler with:

 Sys.set_signal Sys.sigchld (Sys.Signal_handle (fun _ -> ())) 


period : Every period seconds the process status is checked. Defaults to 0.1 seconds.

This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml