#ifndef FORKEDCALLS_H
#define FORKEDCALLS_H
-#include "support/shared_ptr.h"
+#include "support/signals.h"
#include "support/strfwd.h"
-#include <boost/signal.hpp>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
+#include <memory>
+
+
namespace lyx {
namespace support {
///
virtual ~ForkedProcess() {}
///
- virtual shared_ptr<ForkedProcess> clone() const = 0;
+ virtual std::shared_ptr<ForkedProcess> clone() const = 0;
- /** A SignalType signal can be emitted once the forked process
+ /** A Signal signal can be emitted once the forked process
* has finished. It passes:
* the PID of the child and;
* the return value from the child.
* we can return easily to C++ methods, rather than just globally
* accessible functions.
*/
- typedef boost::signal<void(pid_t, int)> SignalType;
+ typedef signals2::signal<void(pid_t, int)> sig;
+ typedef sig::slot_type slot;
/** The signal is connected in the calling routine to the desired
* slot. We pass a shared_ptr rather than a reference to the signal
* class (and hence the signal) to be destructed before the forked
* call is complete.
*
- * It doesn't matter if the slot disappears, SigC takes care of that.
+ * Use Slot::track or Signal::scoped_connection to ensure that the
+ * connection is closed before the slot expires.
*/
- typedef shared_ptr<SignalType> SignalTypePtr;
+ typedef std::shared_ptr<sig> sigPtr;
/** Invoking the following methods makes sense only if the command
* is running asynchronously!
pid_t fork();
/// Callback function
- SignalTypePtr signal_;
+ sigPtr signal_;
/// identifying command (for display in the GUI perhaps).
std::string command_;
};
-/**
+/**
* An instance of class ForkedCall represents a single child process.
*
- * Class ForkedCall uses fork() and execvp() to lauch the child process.
+ * Class ForkedCall uses fork() and execvp() to launch the child process.
*
* Once launched, control is returned immediately to the parent process
* but a Signal can be emitted upon completion of the child.
class ForkedCall : public ForkedProcess {
public:
///
- ForkedCall(std::string const & path = empty_string());
+ ForkedCall(std::string const & path = empty_string(),
+ std::string const & lpath = empty_string());
///
- virtual shared_ptr<ForkedProcess> clone() const {
- return shared_ptr<ForkedProcess>(new ForkedCall(*this));
+ std::shared_ptr<ForkedProcess> clone() const override {
+ return std::make_shared<ForkedCall>(*this);
}
/** Start the child process.
int startScript(Starttype, std::string const & what);
///
- int startScript(std::string const & what, SignalTypePtr);
+ int startScript(std::string const & what, sigPtr ptr);
private:
///
- virtual int generateChild();
+ int generateChild() override;
///
std::string cmd_prefix_;
};
namespace ForkedCallQueue {
-ForkedCall::SignalTypePtr add(std::string const & process);
+ForkedCall::sigPtr add(std::string const & process);
/// Query whether the queue is running a forked process now.
bool running();
-}
+} // namespace ForkedCallQueue
/**