X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Fforkedcontr.h;h=7f55c798d06e15bfdcdc77b045a995e5c286c5fd;hb=c8429d4bbc2e9291a6b5742233aecb089a3eece1;hp=8768015be9dfed075934fce2347fdc7c92ab249c;hpb=4e9ea80fb58b159c03ab5e16bbdc2ddf2497e19b;p=lyx.git diff --git a/src/support/forkedcontr.h b/src/support/forkedcontr.h index 8768015be9..7f55c798d0 100644 --- a/src/support/forkedcontr.h +++ b/src/support/forkedcontr.h @@ -17,11 +17,16 @@ #define FORKEDCONTR_H #include -#include -//#include // needed for pid_t + +#ifdef HAVE_SYS_TYPES_H +# include +#endif + #include +#include #include + namespace lyx { namespace support { @@ -32,38 +37,21 @@ public: /// Get hold of the only controller that can exist inside the process. static ForkedcallsController & get(); - /// Are there any completed child processes to be cleaned-up after? - bool processesCompleted() const { return current_child != -1; } + /// Add a new child process to the list of controlled processes. + void addCall(ForkedProcess const &); /** Those child processes that are found to have finished are removed * from the list and their callback function is passed the final * return state. - */ + */ void handleCompletedProcesses(); - /// Add a new child process to the list of controlled processes. - void addCall(ForkedProcess const &); - /** Kill this process prematurely and remove it from the list. * The process is killed within tolerance secs. * See forkedcall.[Ch] for details. */ void kill(pid_t, int tolerance = 5); - struct Data { - Data() : pid(0), status(0) {} - pid_t pid; - int status; - }; - - /** These data are used by the SIGCHLD handler to populate a list - * of child processes that have completed and been reaped. - * The associated signals are then emitted within the main LyX - * event loop. - */ - std::vector reaped_children; - sig_atomic_t current_child; - private: ForkedcallsController(); ForkedcallsController(ForkedcallsController const &); @@ -77,11 +65,14 @@ private: /// The child processes ListType forkedCalls; - - /// Used to block SIGCHLD signals. - sigset_t newMask, oldMask; }; + +#if defined(_WIN32) +// a wrapper for GetLastError() and FormatMessage(). +std::string const getChildErrorMessage(); +#endif + } // namespace support } // namespace lyx