]> git.lyx.org Git - lyx.git/blobdiff - src/support/forkedcontr.C
* lyxfunctional.h: delete compare_memfun and helper classes
[lyx.git] / src / support / forkedcontr.C
index a8074729a94c1d4cfd41893934f90979074851c6..07546eeee8d9ef37e3f50508afd1d7a418259a90 100644 (file)
 
 #include "forkedcontr.h"
 #include "forkedcall.h"
-#include "lyxfunctional.h"
 
 #include "debug.h"
 
+#include <boost/bind.hpp>
 #include <boost/iterator/indirect_iterator.hpp>
 
 #include <cerrno>
 #include <unistd.h>
 #include <sys/wait.h>
 
+using boost::bind;
+
 using std::endl;
+using std::equal_to;
 using std::find_if;
 
 using std::string;
@@ -165,7 +168,8 @@ void child_handler(int)
        ForkedcallsController & fcc = ForkedcallsController::get();
 
        // Be safe
-       if (fcc.current_child+1 >= fcc.reaped_children.size())
+       typedef vector<ForkedcallsController::Data>::size_type size_type;
+       if (size_type(fcc.current_child + 1) >= fcc.reaped_children.size())
                return;
 
        ForkedcallsController::Data & store =
@@ -228,8 +232,9 @@ ForkedcallsController::iterator ForkedcallsController::find_pid(pid_t pid)
        iterator begin = boost::make_indirect_iterator(forkedCalls.begin());
        iterator end   = boost::make_indirect_iterator(forkedCalls.end());
        iterator it = find_if(begin, end,
-                             lyx::compare_memfun(&Forkedcall::pid, pid));
-
+                             bind(equal_to<pid_t>(),
+                                  bind(&Forkedcall::pid, _1),
+                                  pid));
        return it.base();
 }
 
@@ -260,8 +265,11 @@ void ForkedcallsController::handleCompletedProcesses()
                Data & store = reaped_children[i];
 
                if (store.pid == -1) {
-                       lyxerr << "LyX: Error waiting for child: "
-                              << strerror(errno) << endl;
+                       // Might happen perfectly innocently, eg as a result
+                       // of the system (3) call.
+                       if (errno)
+                               lyxerr << "LyX: Error waiting for child: "
+                                      << strerror(errno) << endl;
                        continue;
                }