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;
58 fd[0] = 0;
fd[1] = 0;
fd[2] = 0;
117 int submitCmd(std::vector<std::string> &args);
172 int popen3(
int fd[3], pid_t *pid,
const char ** argv );
183 virtual void run(
int key);
std::map< int, dmTask * > tasks
This map works like a sparse array :-)
Definition: TaskExec.h:177
virtual void run(int key)
void splitCmd()
Split che command string into the single parms.
int key
Definition: TaskExec.h:64
Definition: TaskExec.h:40
dmTaskExec * loggerinst
Definition: TaskExec.h:88
Definition: TaskExec.h:97
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:67
bool finished
Definition: TaskExec.h:72
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:71
int fd[3]
Definition: TaskExec.h:74
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:175
int getTaskCounters(int &tot, int &running)
void notifyAll()
Definition: TaskExec.h:84
boost::condition_variable condvar
Definition: TaskExec.h:47
std::string stdout
Definition: TaskExec.h:76
std::string instance
Definition: TaskExec.h:102
std::string cmd
Definition: TaskExec.h:66
int getTaskStdout(int taskID, std::string &stdout)
time_t endtime
Definition: TaskExec.h:71
pid_t pid
Definition: TaskExec.h:75
virtual void onTaskCompleted(dmTask &task)
int resultcode
Definition: TaskExec.h:69
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:50
Namespace for the dmlite C++ API.
Definition: authn.h:15
virtual void onErrLoggingRequest(std::string const &msg)=0
Event invoked internally to log stuff.
dmTask * getTask(int taskID)