]> git.lyx.org Git - lyx.git/blobdiff - src/support/forkedcall.C
Create a grfx::Loader class and so move large chunks of code out of
[lyx.git] / src / support / forkedcall.C
index 287e627902d8b28807d79a996e50b009520ae056..8847ce7122df7c4d74241237d2d518cb707701a9 100644 (file)
@@ -35,6 +35,8 @@
 #include "debug.h"
 #include "frontends/Timeout.h"
 
+#include <boost/bind.hpp>
+
 #include <cerrno>
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -66,7 +68,7 @@ int Forkedcall::startscript(Starttype wait, string const & what)
                } else {
                        retval_ = waitForChild();
                }
-               
+
                return retval_;
        }
 
@@ -100,14 +102,14 @@ int Forkedcall::startscript(string const & what, SignalTypePtr signal)
 void Forkedcall::emitSignal()
 {
        if (signal_.get()) {
-               signal_->emit(command_, pid_, retval_);
+               signal_->operator()(command_, pid_, retval_);
        }
 }
 
 
 namespace {
 
-class Murder : public SigC::Object {
+class Murder : public boost::signals::trackable {
 public:
        //
        static void killItDead(int secs, pid_t pid)
@@ -135,7 +137,7 @@ private:
                : timeout_(0), pid_(pid)
        {
                timeout_ = new Timeout(1000*secs, Timeout::ONETIME);
-               timeout_->timeout.connect(SigC::slot(this, &Murder::kill));
+               timeout_->timeout.connect(boost::bind(&Murder::kill, this));
                timeout_->start();
        }
 
@@ -197,13 +199,13 @@ int Forkedcall::waitForChild() {
                        wait = false;
                } else if (WIFSIGNALED(status)) {
                        lyxerr << "LyX: Child didn't catch signal "
-                              << WTERMSIG(status) 
+                              << WTERMSIG(status)
                               << "and died. Too bad." << endl;
                        wait = false;
                } else if (WIFSTOPPED(status)) {
                        lyxerr << "LyX: Child (pid: " << pid_
                               << ") stopped on signal "
-                              << WSTOPSIG(status) 
+                              << WSTOPSIG(status)
                               << ". Waiting for child to finish." << endl;
                } else {
                        lyxerr << "LyX: Something rotten happened while "
@@ -219,7 +221,7 @@ int Forkedcall::waitForChild() {
 pid_t Forkedcall::generateChild()
 {
        const int MAX_ARGV = 255;
-       char *syscmd = 0; 
+       char *syscmd = 0;
        char *argv[MAX_ARGV];
 
        string childcommand(command_); // copy
@@ -243,7 +245,7 @@ pid_t Forkedcall::generateChild()
 
                // reinit
                more = !rest.empty();
-               if (more) 
+               if (more)
                        rest = split(rest, childcommand, ' ');
        }
        argv[index] = 0;