4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Asger Alstrup Nielsen
8 * \author Angus Leeming
10 * Full author contact details are available in file CREDITS.
12 * A class for the control of child processes launched using
13 * fork() and execvp().
19 #include <sys/types.h> // needed for pid_t
30 class ForkedcallsController {
32 /// Get hold of the only controller that can exist inside the process.
33 static ForkedcallsController & get();
35 /// Add a new child process to the list of controlled processes.
36 void addCall(ForkedProcess const &);
38 /** Kill this process prematurely and remove it from the list.
39 * The process is killed within tolerance secs.
40 * See forkedcall.[Ch] for details.
42 void kill(pid_t, int tolerance = 5);
45 ForkedcallsController();
46 ForkedcallsController(ForkedcallsController const &);
47 ~ForkedcallsController();
49 /** This method is connected to the timer. Every XX ms it is called
50 * so that we can check on the status of the children. Those that
51 * are found to have finished are removed from the list and their
52 * callback function is passed the final return state.
56 /// The child processes
57 typedef std::list<ForkedProcess *> ListType;
61 /** The timer. Enables us to check the status of the children
62 * every XX ms and to invoke a callback on completion.
67 } // namespace support
70 #endif // FORKEDCONTR_H