#ifndef __TASK_H__ #define __TASK_H__ #ifdef __cplusplus #include #include #include #include #include #define TASK_ON_HOLD 0 #define TASK_DONE 1 #define TASK_BURST 2 #define W4_STICKY 1 class Task : public Base { public: Task(); virtual ~Task(); virtual String GetName(); int Run(); int GetState(); void Suspend() throw (GeneralException); void WaitFor(Handle *, int = 0); void WaitFor(Task *); void WaitFor(pid_t); void WaitFor(struct timeval, int = 0); bool WaitingFor(Handle *); bool WaitingFor(pid_t); void SetBurst(); void SetCleanUp(); bool HasToClean(); void Stop(); void Restart(); bool IsStopped(); protected: virtual int Do() throw (GeneralException); int current; private: class w4ha_t { public: w4ha_t(Handle * aha, int aflags) : ha(aha), flags(aflags) { } Handle * ha; int flags; }; class wbta_t { public: wbta_t(Task * ata) : ta(ata) { } Task * ta; }; class w4pr_t { public: w4pr_t(pid_t apr) : pr(apr) { } pid_t pr; }; class w4to_t { public: w4to_t(timeval ato, int aflags) : to(ato), flags(aflags) { } timeval to; int flags; }; int state; bool stopped; bool cleanup; bool suspended; vector w4ha; vector wbta; vector w4pr; vector w4to; }; #else #error This only works with a C++ compiler #endif #endif