]> git.lyx.org Git - lyx.git/blobdiff - src/support/ForkedCalls.h
Replace the text class shared ptr by good old index-into-global-list.
[lyx.git] / src / support / ForkedCalls.h
index 0a226fcb7c933bb3a2270cec6e61e43a61a8b305..e628f882cc83abefff2c522f8303d6d164b3a923 100644 (file)
@@ -43,7 +43,7 @@ public:
        ///
        virtual boost::shared_ptr<ForkedProcess> clone() const = 0;
 
-       /** A SignalType signal is can be emitted once the forked process
+       /** A SignalType signal can be emitted once the forked process
         *  has finished. It passes:
         *  the PID of the child and;
         *  the return value from the child.
@@ -97,12 +97,21 @@ public:
         */
        void kill(int tolerance = 5);
 
+       /// Returns true if this is a child process
+       static bool iAmAChild() { return IAmAChild; }
+
 protected:
        /** Spawn the child process.
         *  Returns returncode from child.
         */
        int run(Starttype type);
 
+       /// implement our own version of fork()
+       /// it just returns -1 if ::fork() is not defined
+       /// otherwise, it forks and sets the global child-process
+       /// boolean IAmAChild
+       pid_t fork();
+
        /// Callback function
        SignalTypePtr signal_;
 
@@ -118,6 +127,9 @@ private:
        /// generate child in background
        virtual int generateChild() = 0;
 
+       ///
+       static bool IAmAChild;
+
        /// Wait for child process to finish. Updates returncode from child.
        int waitForChild();
 };