#define FORKEDCALL_H
#include <boost/shared_ptr.hpp>
-#include <boost/signals/signal2.hpp>
-#include <boost/function/function0.hpp>
+#include <boost/signal.hpp>
#include <sys/types.h>
///
virtual ~ForkedProcess() {}
///
- virtual ForkedProcess * clone() const = 0;
+ virtual boost::shared_ptr<ForkedProcess> clone() const = 0;
/** A SignalType signal is can be emitted once the forked process
* has finished. It passes:
* we can return easily to C++ methods, rather than just globally
* accessible functions.
*/
- typedef boost::signal2<void, pid_t, int> SignalType;
+ typedef boost::signal<void(pid_t, int)> SignalType;
/** The signal is connected in the calling routine to the desired
* slot. We pass a shared_ptr rather than a reference to the signal
void kill(int tolerance = 5);
protected:
- /** Wait for child process to finish.
+ /** Spawn the child process.
* Returns returncode from child.
*/
- int runBlocking();
- /** Do not wait for child process to finish.
- * Returns returncode from child.
- */
- int runNonBlocking();
+ int run(Starttype type);
/// Callback function
SignalTypePtr signal_;
class Forkedcall : public ForkedProcess {
public:
///
- virtual ForkedProcess * clone() const {
- return new Forkedcall(*this);
+ virtual boost::shared_ptr<ForkedProcess> clone() const {
+ return boost::shared_ptr<ForkedProcess>(new Forkedcall(*this));
}
/** Start the child process.