-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProcessManager.hpp
44 lines (37 loc) · 996 Bytes
/
ProcessManager.hpp
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
/*
NAME
ProcessManager.hpp - Header file of the Process Manager class.
DESCRIPTION
Process Manager.
*/
#ifndef __PROCESS_MANAGER_HPP__
#define __PROCESS_MANAGER_HPP__
#include "Configure.hpp"
#include "WorkerProcess.hpp"
#define S_COMMAND "command"
#define S_WORK_DIR "work-dir"
#define S_OK "OK"
#define S_ERROR "ERROR"
#define S_SKIP "SKIP"
#define S_NO_WORKER "NO SUCH WORKER"
class ProcessManager {
public:
static ProcessManager* instance(std::string filename);
static void destory();
static ProcessManager* _instance;
std::string start(std:: string name);
std::string stop(std:: string name);
std::string status();
std::string reload();
void start_worker_processes();
protected:
ProcessManager(std::string filename);
~ProcessManager();
private:
pthread_mutex_t* _mutex;
std::string _filename;
ConfigFile* _config_file;
std::map<std::string, WorkerProcess> _processes;
void relaunch(int old_pid);
};
#endif