]> git.lyx.org Git - lyx.git/blobdiff - src/support/forkedcontr.C
another safety belt
[lyx.git] / src / support / forkedcontr.C
index 11cc31b4f1edd6e4d0c19d8f647065fe63d7a4b6..d5f5d3eacf0c746ba24f1766319a928e75702a83 100644 (file)
@@ -1,12 +1,14 @@
 /**
  * \file forkedcontr.C
- * Copyright 2001 The LyX Team
- * Read COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
  * \author Asger Alstrup Nielsen
  * \author Angus Leeming
  *
- * A class for the control of child processes launched using 
+ * Full author contact details are available in file CREDITS
+ *
+ * A class for the control of child processes launched using
  * fork() and execvp().
  */
 
 #include "forkedcontr.h"
 #include "forkedcall.h"
 #include "lyxfunctional.h"
-#include "frontends/Timeout.h"
 #include "debug.h"
 
+#include "frontends/Timeout.h"
+
+#include <boost/bind.hpp>
+
 #include <cerrno>
 #include <cstdlib>
 #include <unistd.h>
@@ -46,9 +51,9 @@ ForkedcallsController & ForkedcallsController::get()
 ForkedcallsController::ForkedcallsController()
 {
        timeout_ = new Timeout(100, Timeout::ONETIME);
-       
+
        timeout_->timeout
-               .connect(SigC::slot(this, &ForkedcallsController::timer));
+               .connect(boost::bind(&ForkedcallsController::timer, this));
 }
 
 
@@ -66,15 +71,13 @@ ForkedcallsController::~ForkedcallsController()
 }
 
 
-// Add child process information to the list of controlled processes
-void ForkedcallsController::addCall(Forkedcall const &newcall)
+void ForkedcallsController::addCall(ForkedProcess const & newcall)
 {
        if (!timeout_->running())
                timeout_->start();
 
-       Forkedcall * call = new Forkedcall(newcall);
-       forkedCalls.push_back(call);
-       childrenChanged.emit();
+       forkedCalls.push_back(newcall.clone());
+       childrenChanged();
 }
 
 
@@ -86,7 +89,7 @@ void ForkedcallsController::timer()
 
        for (ListType::iterator it = forkedCalls.begin();
             it != forkedCalls.end(); ++it) {
-               Forkedcall * actCall = *it;
+               ForkedProcess * actCall = *it;
 
                pid_t pid = actCall->pid();
                int stat_loc;
@@ -94,7 +97,7 @@ void ForkedcallsController::timer()
                bool remove_it = false;
 
                if (waitrpid == -1) {
-                       lyxerr << "LyX: Error waiting for child: " 
+                       lyxerr << "LyX: Error waiting for child: "
                               << strerror(errno) << endl;
 
                        // Child died, so pretend it returned 1
@@ -116,9 +119,9 @@ void ForkedcallsController::timer()
                        remove_it = true;
 
                } else if (WIFSTOPPED(stat_loc)) {
-                       lyxerr << "LyX: Child (pid: " << pid 
+                       lyxerr << "LyX: Child (pid: " << pid
                               << ") stopped on signal "
-                              << WSTOPSIG(stat_loc) 
+                              << WSTOPSIG(stat_loc)
                               << ". Waiting for child to finish." << endl;
 
                } else {
@@ -148,7 +151,7 @@ void ForkedcallsController::timer()
        }
 
        if (start_size != forkedCalls.size())
-               childrenChanged.emit();
+               childrenChanged();
 }