summaryrefslogtreecommitdiff
path: root/include/Task.h
blob: f728e624fc8125afb3fded26e84d54fa99d39b23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef __TASK_H__
#define __TASK_H__
#ifdef __cplusplus

#include <unistd.h>
#include <vector.h>
#include <Exceptions.h>

#define TASK_ON_HOLD 	0
#define TASK_DONE 	1

class Task : public Base {
  public:
      Task();
      virtual ~Task();
    virtual String GetName();
    int Run();
    int GetState();
    void Suspend() throw (GeneralException);
    bool WaitFor(Handle *);
    bool WaitFor(Task *);
    bool WaitFor(pid_t);
    bool WaitFor(struct timeval);
  protected:
    virtual int Do();
    
  private:
    int state;
    bool suspended;
    vector<Handle *> w4ha;
    vector<Task *> w4ta;
    vector<pid_t> w4pr;
    vector<struct timeval> w4to;
};

#else
#error This only works with a C++ compiler
#endif
#endif