17 #ifndef DMLITE_TASKEXEC_H
18 #define DMLITE_TASKEXEC_H
27 #include <boost/thread.hpp>
53 for(
unsigned int i = 0; i < 64; i++)
parms[i] = NULL;
59 fd[0] = 0;
fd[1] = 0;
fd[2] = 0;
119 int submitCmd(std::vector<std::string> &args);
174 int popen3(
int fd[3], pid_t *pid,
const char ** argv );
185 virtual void run(
int key);
std::map< int, dmTask * > tasks
This map works like a sparse array :-)
Definition: TaskExec.h:179
virtual void run(int key)
bool running
Definition: TaskExec.h:73
void splitCmd()
Split che command string into the single parms.
int key
Definition: TaskExec.h:65
Definition: TaskExec.h:40
int getTaskCounters(int &tot, int &running, int &finished)
dmTaskExec * loggerinst
Definition: TaskExec.h:90
Definition: TaskExec.h:99
virtual void onLoggingRequest(Logger::Level lvl, std::string const &msg)=0
Event invoked internally to log stuff.
int popen3(int fd[3], pid_t *pid, const char **argv)
int waitResult(int taskID, int tmout=5)
const char * parms[64]
Definition: TaskExec.h:68
bool finished
Definition: TaskExec.h:74
dmTask(dmTaskExec *wheretolog)
int waitFinished(int tmout=5)
Wait until the task has finished or the timeout is expired.
void assignCmd(dmTask *task, std::vector< std::string > &args)
Split che command string into the single parms.
int submitCmd(std::string cmd)
time_t starttime
Definition: TaskExec.h:72
int fd[3]
Definition: TaskExec.h:76
int taskcnt
Used to create keys to be inserted into the map. This has to be treated modulo MAXINT or similar big ...
Definition: TaskExec.h:177
void notifyAll()
Definition: TaskExec.h:86
boost::condition_variable condvar
Definition: TaskExec.h:47
std::string stdout
Definition: TaskExec.h:78
std::string instance
Definition: TaskExec.h:104
std::string cmd
Definition: TaskExec.h:67
int getTaskStdout(int taskID, std::string &stdout)
time_t endtime
Definition: TaskExec.h:72
pid_t pid
Definition: TaskExec.h:77
virtual void onTaskCompleted(dmTask &task)
int resultcode
Definition: TaskExec.h:70
virtual void onTaskRunning(dmTask &task)
NOTE the signature. This passes copies of Task objects, not the originals.
dmTask(const dmTask &o)
Definition: TaskExec.h:50
Level
Definition: logger.h:88
virtual void onErrLoggingRequest(std::string const &msg)=0
Event invoked internally to log stuff.
dmTask * getTask(int taskID)