// Custom includes
#include <deque>
+#include <list>
#include <boost/utility.hpp>
#include <boost/function.hpp>
#include "../Scheduler/Scheduler.hh"
{
public:
- DaemonWatcher(int pid, int coutpipe, int cerrpipe);
+ DaemonWatcher(int pid, int coutpipe, int cerrpipe, int stdout, int stderr);
void run();
public:
typedef boost::function<void ()> Callback;
- Forwarder(int src, int dst, Callback cb);
+ Forwarder(int src, Callback cb);
~Forwarder();
+ void addTarget(int fd);
+
private:
+ typedef std::deque<char> Buffer;
+ struct Target
+ {
+ int fd;
+ Buffer::size_type offset;
+ };
+ typedef std::list<Target> Targets;
+
void readData(Scheduler::EventId event);
- void writeData(Scheduler::EventId event);
+ void writeData(Scheduler::EventId event, Targets::iterator target);
- typedef std::deque<char> Buffer;
Buffer buffer_;
int src_;
- int dst_;
+
+ Targets targets_;
+
Callback cb_;
};
- void pipeClosed();
+ void pipeClosed(int id);
+ void sigChld();
void childDied();
void childOk();
int childPid_;
int coutpipe_;
int cerrpipe_;
+ int stdout_;
+ int stderr_;
+ bool sigChld_;
Forwarder coutForwarder_;
Forwarder cerrForwarder_;
-
- bool timerRunning_;
};
}}