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