X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2FForkedCalls.h;h=8a4bf1d4aa40a9cc53a4e904fd73ff464eab4cbc;hb=e8c1cb5074e36a344553d57537f8177345a86686;hp=f770ff5ef239e76cb8c5416852d5e1d9c062f048;hpb=2047ea5eb436d98d485bed672ed218f9bd708ce6;p=lyx.git diff --git a/src/support/ForkedCalls.h b/src/support/ForkedCalls.h index f770ff5ef2..8a4bf1d4aa 100644 --- a/src/support/ForkedCalls.h +++ b/src/support/ForkedCalls.h @@ -14,8 +14,8 @@ #ifndef FORKEDCALLS_H #define FORKEDCALLS_H +#include "support/signals.h" #include "support/strfwd.h" -#include #ifdef HAVE_SYS_TYPES_H # include @@ -24,8 +24,6 @@ #include -using std::shared_ptr; - namespace lyx { namespace support { @@ -44,9 +42,9 @@ public: /// virtual ~ForkedProcess() {} /// - virtual shared_ptr clone() const = 0; + virtual std::shared_ptr 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. @@ -55,7 +53,8 @@ public: * we can return easily to C++ methods, rather than just globally * accessible functions. */ - typedef boost::signals2::signal SignalType; + typedef signals2::signal 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 @@ -63,9 +62,10 @@ public: * 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 SignalTypePtr; + typedef std::shared_ptr sigPtr; /** Invoking the following methods makes sense only if the command * is running asynchronously! @@ -116,7 +116,7 @@ protected: pid_t fork(); /// Callback function - SignalTypePtr signal_; + sigPtr signal_; /// identifying command (for display in the GUI perhaps). std::string command_; @@ -138,7 +138,7 @@ private: }; -/** +/** * An instance of class ForkedCall represents a single child process. * * Class ForkedCall uses fork() and execvp() to lauch the child process. @@ -157,7 +157,7 @@ public: ForkedCall(std::string const & path = empty_string(), std::string const & lpath = empty_string()); /// - virtual shared_ptr clone() const { + virtual std::shared_ptr clone() const { return std::make_shared(*this); } @@ -177,7 +177,7 @@ public: int startScript(Starttype, std::string const & what); /// - int startScript(std::string const & what, SignalTypePtr); + int startScript(std::string const & what, sigPtr ptr); private: /// @@ -197,11 +197,11 @@ private: 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 /**