Remove cruft left over from the removal of the Forks dialog.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8511 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2004-03-22 14:10:20 +00:00
parent 85bb58ad1d
commit d4c54a1da3
3 changed files with 15 additions and 71 deletions

View File

@ -1,3 +1,8 @@
2004-03-22 Angus Leeming <leeming@lyx.org>
* forkedcontr.[Ch] (childrenChanged, getPIDs, getCommand): remove
cruft left over from the removal of the Forks dialog.
2004-03-09 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* filename.[Ch] (mangledFilename): make sure that mangled names are

View File

@ -34,7 +34,6 @@ using boost::bind;
using std::endl;
using std::find_if;
using std::string;
using std::vector;
#ifndef CXX_GLOBAL_CSTD
using std::strerror;
@ -81,7 +80,6 @@ void ForkedcallsController::addCall(ForkedProcess const & newcall)
timeout_->start();
forkedCalls.push_back(newcall.clone().release());
childrenChanged();
}
@ -89,8 +87,6 @@ void ForkedcallsController::addCall(ForkedProcess const & newcall)
// Check the list and, if there is a stopped child, emit the signal.
void ForkedcallsController::timer()
{
ListType::size_type start_size = forkedCalls.size();
ListType::iterator it = forkedCalls.begin();
ListType::iterator end = forkedCalls.end();
while (it != end) {
@ -155,44 +151,6 @@ void ForkedcallsController::timer()
if (!forkedCalls.empty() && !timeout_->running()) {
timeout_->start();
}
if (start_size != forkedCalls.size())
childrenChanged();
}
// Return a vector of the pids of all the controlled processes.
vector<pid_t> const ForkedcallsController::getPIDs() const
{
vector<pid_t> pids;
if (forkedCalls.empty())
return pids;
pids.resize(forkedCalls.size());
vector<pid_t>::iterator vit = pids.begin();
for (ListType::const_iterator lit = forkedCalls.begin();
lit != forkedCalls.end(); ++lit, ++vit) {
*vit = (*lit)->pid();
}
std::sort(pids.begin(), pids.end());
return pids;
}
// Get the command string of the process.
string const ForkedcallsController::getCommand(pid_t pid) const
{
ListType::const_iterator it =
find_if(forkedCalls.begin(), forkedCalls.end(),
lyx::compare_memfun(&Forkedcall::pid, pid));
if (it == forkedCalls.end())
return string();
return (*it)->command();
}

View File

@ -16,13 +16,9 @@
#ifndef FORKEDCONTR_H
#define FORKEDCONTR_H
#include <boost/signals/signal0.hpp>
#include <boost/signals/trackable.hpp>
#include <sys/types.h> // needed for pid_t
#include <list>
#include <vector>
class Timeout;
@ -31,46 +27,31 @@ namespace support {
class ForkedProcess;
class ForkedcallsController : public boost::signals::trackable {
class ForkedcallsController {
public:
/// We need this to avoid warnings.
ForkedcallsController();
/** This d-tor should really be private, but making it public
* allows egcs 1.1 to compile the class.
*/
~ForkedcallsController();
/// Get hold of the only controller that can exist inside the process.
static ForkedcallsController & get();
/// Add a new child process to the list of controlled processes.
void addCall(ForkedProcess const &);
/** This method is connected to the timer. Every XX ms it is called
* so that we can check on the status of the children. Those that
* are found to have finished are removed from the list and their
* callback function is passed the final return state.
*/
void timer();
/// Return a vector of the pids of all the controlled processes.
std::vector<pid_t> const getPIDs() const;
/// Get the command string of the process.
std::string const getCommand(pid_t) const;
/** Kill this process prematurely and remove it from the list.
* The process is killed within tolerance secs.
* See forkedcall.[Ch] for details.
*/
void kill(pid_t, int tolerance = 5);
/// Signal emitted when the list of current child processes changes.
boost::signal0<void> childrenChanged;
private:
///
ForkedcallsController();
ForkedcallsController(ForkedcallsController const &);
~ForkedcallsController();
/** This method is connected to the timer. Every XX ms it is called
* so that we can check on the status of the children. Those that
* are found to have finished are removed from the list and their
* callback function is passed the final return state.
*/
void timer();
/// The child processes
typedef std::list<ForkedProcess *> ListType;