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
|
#ifndef __TASKMAN_H__
#define __TASKMAN_H__
#ifdef __cplusplus
#include <Task.h>
#include <vector.h>
class TaskMan : public Base {
public:
static int AddTask(Task *);
static void Init() throw (GeneralException);
static void MainLoop() throw (GeneralException);
static void WaitFor(Handle *, Task *, int = 0);
static void WaitFor(pid_t, Task *);
static void WaitFor(timeval, Task *, int = 0);
class w4ha_t {
public:
w4ha_t(Handle * aha, int aflags, Task * aT) : ha(aha), flags(aflags), T(aT) { }
Handle * ha;
int flags;
Task * T;
};
class w4pr_t {
public:
w4pr_t(pid_t apr, Task * aT) : pr(apr), T(aT) { }
pid_t pr;
Task * T;
};
class w4to_t {
public:
w4to_t(timeval ato, int aflags, Task * aT) : to(ato), flags(aflags), T(aT) { }
timeval to;
int flags;
Task * T;
};
typedef vector<Task *> TaskList_t;
private:
static TaskList_t TaskList;
static TaskList_t Zombies;
static int number;
static bool inited;
static vector<w4ha_t> w4ha;
static vector<w4pr_t> w4pr;
static vector<w4to_t> w4to;
};
#else
#error This only works with a C++ compiler
#endif
#endif
|