]> git.lyx.org Git - lyx.git/blobdiff - src/support/forkedcontr.h
Detect mode_t for safe use of chmod, and for scons/msvc
[lyx.git] / src / support / forkedcontr.h
index 1ba6c78386d6206aaeeee60fe9113224ac9151e2..7f55c798d06e15bfdcdc77b045a995e5c286c5fd 100644 (file)
 #define FORKEDCONTR_H
 
 #include <boost/shared_ptr.hpp>
-#include <sys/types.h> // needed for pid_t
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
 #include <list>
+#include <string>
+#include <vector>
 
-class Timeout;
 
 namespace lyx {
 namespace support {
@@ -35,6 +40,12 @@ public:
        /// 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();
+
        /** Kill this process prematurely and remove it from the list.
         *  The process is killed within tolerance secs.
         *  See forkedcall.[Ch] for details.
@@ -46,25 +57,22 @@ private:
        ForkedcallsController(ForkedcallsController const &);
        ~ForkedcallsController();
 
-       /** This method is connected to the timer. Every XX ms it is called
-        *  so that we can check on the status of the children. Those that
-        *  are found to have finished are removed from the list and their
-        *  callback function is passed the final return state.
-        */
-       void timer();
-
-       /// The child processes
        typedef boost::shared_ptr<ForkedProcess> ForkedProcessPtr;
        typedef std::list<ForkedProcessPtr> ListType;
-       ///
-       ListType forkedCalls;
+       typedef ListType::iterator iterator;
 
-       /** The timer. Enables us to check the status of the children
-        *  every XX ms and to invoke a callback on completion.
-        */
-       Timeout * timeout_;
+       iterator find_pid(pid_t);
+
+       /// The child processes
+       ListType forkedCalls;
 };
 
+
+#if defined(_WIN32)
+// a wrapper for GetLastError() and FormatMessage().
+std::string const getChildErrorMessage();
+#endif
+
 } // namespace support
 } // namespace lyx