Go to the documentation of this file.
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;
172 int popen3(
int fd[3], pid_t *pid,
const char ** argv );
183 virtual void run(
int key);
int waitResult(int taskID, int tmout=5)
int submitCmd(std::vector< std::string > &args)
Executes a command. Returns a positive integer as a key to reference.
virtual void run(int key)
dmTask * getTask(int taskID)
virtual void onLoggingRequest(Logger::Level lvl, std::string const &msg)=0
Event invoked internally to log stuff.
int getTaskCounters(int &tot, int &running)
void splitCmd()
Split che command string into the single parms.
dmTaskExec * loggerinst
Definition: TaskExec.h:88
int key
Definition: TaskExec.h:64
virtual void onErrLoggingRequest(std::string const &msg)=0
Event invoked internally to log stuff.
const char * parms[64]
Definition: TaskExec.h:67
std::map< int, dmTask * > tasks
This map works like a sparse array :-)
Definition: TaskExec.h:177
int submitCmd(std::string cmd)
int waitFinished(int tmout=5)
Wait until the task has finished or the timeout is expired.
bool finished
Definition: TaskExec.h:72
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
time_t starttime
Definition: TaskExec.h:71
dmTask(dmTaskExec *wheretolog)
int fd[3]
Definition: TaskExec.h:74
int popen3(int fd[3], pid_t *pid, const char **argv)
void notifyAll()
Definition: TaskExec.h:84
Definition: TaskExec.h:40
int killTask(dmTask *task)
time_t endtime
Definition: TaskExec.h:71
void assignCmd(dmTask *task, std::vector< std::string > &args)
Split che command string into the single parms.
boost::condition_variable condvar
Definition: TaskExec.h:47
std::string stdout
Definition: TaskExec.h:76
virtual void onTaskCompleted(dmTask &task)
int getTaskStdout(int taskID, std::string &stdout)
std::string cmd
Definition: TaskExec.h:66
std::string instance
Definition: TaskExec.h:102
virtual void onTaskRunning(dmTask &task)
NOTE the signature. This passes copies of Task objects, not the originals.
pid_t pid
Definition: TaskExec.h:75
int resultcode
Definition: TaskExec.h:69
Namespace for the dmlite C++ API.
Definition: authn.h:15
dmTask(const dmTask &o)
Definition: TaskExec.h:50
Level
Definition: logger.h:89
Definition: TaskExec.h:97