X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Fforkedcontr.C;h=7df4e211c373c7849cb131924b4e9c07b68c908d;hb=5e7275dabc36e1acb396c45ba27aecf8d8a0171e;hp=13b397eb8887c5881fac7a27c0b70f38f62919bf;hpb=607ad8d3a778a23013f5c5a9382e9af3cb64350d;p=lyx.git diff --git a/src/support/forkedcontr.C b/src/support/forkedcontr.C index 13b397eb88..7df4e211c3 100644 --- a/src/support/forkedcontr.C +++ b/src/support/forkedcontr.C @@ -6,7 +6,7 @@ * \author Asger Alstrup Nielsen * \author Angus Leeming * - * A class for the control of child processes launched using + * A class for the control of child processes launched using * fork() and execvp(). */ @@ -19,9 +19,12 @@ #include "forkedcontr.h" #include "forkedcall.h" #include "lyxfunctional.h" -#include "frontends/Timeout.h" #include "debug.h" +#include "frontends/Timeout.h" + +#include + #include #include #include @@ -45,10 +48,10 @@ ForkedcallsController & ForkedcallsController::get() ForkedcallsController::ForkedcallsController() { - timeout_ = new Timeout(100, Timeout::CONTINUOUS); - + timeout_ = new Timeout(100, Timeout::ONETIME); + timeout_->timeout - .connect(SigC::slot(this, &ForkedcallsController::timer)); + .connect(boost::bind(&ForkedcallsController::timer, this)); } @@ -74,7 +77,7 @@ void ForkedcallsController::addCall(Forkedcall const &newcall) Forkedcall * call = new Forkedcall(newcall); forkedCalls.push_back(call); - childrenChanged.emit(); + childrenChanged(); } @@ -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 { @@ -143,12 +146,12 @@ void ForkedcallsController::timer() } } - if (forkedCalls.empty()) { - timeout_->stop(); + if (!forkedCalls.empty()) { + timeout_->start(); } if (start_size != forkedCalls.size()) - childrenChanged.emit(); + childrenChanged(); }