#ifndef __TASK_H__ #define __TASK_H__ #ifndef _WIN32 #include #include #else #include #endif #include #include #include #undef E_HANDLE class Task : public Base { public: enum { EVT_BURST = 0, EVT_HANDLE, EVT_PROCESS, EVT_TIMEOUT, EVT_TASK, }; enum { TASK_ON_HOLD = 0, TASK_DONE, TASK_BURST, }; enum { W4_STICKY = 1, W4_READING = 2, W4_WRITING = 4, }; Task(); virtual ~Task(); virtual String GetName(); int Run(); int DryRun(); int GetState(); void Suspend(int = -1) throw (GeneralException); void WaitFor(Task *); void WaitFor(Handle *, int = 0); void WaitFor(pid_t); void WaitFor(const timeval &, int = 0); Task * WaitedBy(); void SetBurst(); void Stop(); void Restart(); bool IsStopped(); void RemoveFromWatches(); void RemoveTimeout(); Handle * BurstHandle; protected: virtual int Do() throw (GeneralException); int current; private: class wbta_t { public: wbta_t(Task * ata) : ta(ata) { } Task * ta; }; int state; bool stopped; bool suspended; Task * wbta; }; #endif