Definition at line 22 of file Process.h.
◆ Process() [1/2]
◆ Process() [2/2]
Process |
( |
WORKER * |
worker, |
|
|
bool |
detached = true |
|
) |
| |
|
inline |
Definition at line 37 of file Process.h.
38 {
39 m_pid = fork();
40 if (m_pid == 0) {
41 signal(SIGINT, g_handler_int);
42 if (detached) {
43 on_exit(g_handler_exit<WORKER>, (void*)worker);
44 }
45 worker->run();
46 exit(0);
47 } else if (detached) {
48 delete worker;
49 }
50 }
◆ ~Process()
◆ cancel()
Definition at line 71 of file Process.h.
71{ return kill(SIGINT); }
◆ g_handler_exit()
static void g_handler_exit |
( |
int |
, |
|
|
void * |
worker |
|
) |
| |
|
inlinestatic |
Definition at line 26 of file Process.h.
27 {
28 delete (WORKER*)worker;
29 exit(0);
30 }
◆ g_handler_int()
static void g_handler_int |
( |
int |
| ) |
|
|
inlinestatic |
◆ get_id()
◆ id()
◆ isAlive()
◆ kill()
bool kill |
( |
int |
signo | ) |
const |
|
inline |
Definition at line 58 of file Process.h.
59 {
60 if (m_pid <= 0) return false;
61 return ::kill(m_pid, signo) == 0;
62 }
◆ set_id()
◆ wait()
Definition at line 63 of file Process.h.
64 {
65 if (m_pid < 0) return false;
66 if ((m_waitpid_result = ::waitpid(m_pid, &m_waitpid_status, opt))) {
67 m_pid = -1;
68 }
69 return true;
70 }
◆ waitpid_result()
int waitpid_result |
( |
| ) |
const |
|
inline |
Definition at line 72 of file Process.h.
73 {
74 return m_waitpid_result;
75 };
◆ waitpid_status()
int waitpid_status |
( |
| ) |
const |
|
inline |
Definition at line 76 of file Process.h.
77 {
78 return m_waitpid_status;
79 };
◆ m_pid
◆ m_waitpid_result
◆ m_waitpid_status
The documentation for this class was generated from the following file: