blob: b45bfea73502117618473b38aee802e3430e1c69 (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#ifndef __TASK_H__
#define __TASK_H__
#ifdef __cplusplus
#include <unistd.h>
#include <sys/time.h>
#include <vector.h>
#include <Exceptions.h>
#include <Handle.h>
#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 *, int = 0);
void WaitFor(pid_t, int = 0);
void WaitFor(struct timeval, int = 0);
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 w4ta_t {
public:
w4ta_t(Task * ata, int aflags) : ta(ata), flags(aflags) { }
Task * ta;
int flags;
};
class w4pr_t {
public:
w4pr_t(pid_t apr, int aflags) : pr(apr), flags(aflags) { }
pid_t pr;
int flags;
};
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_t> w4ha;
vector<w4ta_t> w4ta;
vector<w4pr_t> w4pr;
vector<w4to_t> w4to;
};
#else
#error This only works with a C++ compiler
#endif
#endif
|