1 | <?php namespace Comodojo\Daemon\Utils; |
||
21 | class ProcessTools { |
||
22 | |||
23 | /** |
||
24 | * Terminate a process, asking PID to terminate or killing it directly. |
||
25 | * |
||
26 | * @param int $pid |
||
27 | * @param int $lagger_timeout Timeout to wait before killing process if it refuses to terminate |
||
28 | * @param int $signal Signal to send (default to SIGTERM) |
||
29 | * |
||
30 | * @return bool |
||
31 | */ |
||
32 | public static function term($pid, $lagger_timeout = 0, $signal = SIGTERM) { |
||
49 | |||
50 | /** |
||
51 | * Kill a process |
||
52 | * |
||
53 | * @param int $pid |
||
54 | * @return bool |
||
55 | */ |
||
56 | public static function kill($pid) { |
||
62 | |||
63 | public static function signal($pid, $signal = SIGUSR1) { |
||
68 | |||
69 | /** |
||
70 | * Return true if process is still running, false otherwise |
||
71 | * |
||
72 | * @param int $pid |
||
73 | * @return bool |
||
74 | */ |
||
75 | public static function isRunning($pid) { |
||
80 | |||
81 | /** |
||
82 | * Get niceness of a running process |
||
83 | * |
||
84 | * @param int|null $pid The pid to query, or current process if null |
||
85 | * @return int |
||
86 | */ |
||
87 | public static function getNiceness($pid = null) { |
||
92 | |||
93 | /** |
||
94 | * Set niceness of a running process |
||
95 | * |
||
96 | * @param int|null $pid The pid to query, or current process if null |
||
97 | * @return bool |
||
98 | */ |
||
99 | 1 | public static function setNiceness($niceness, $pid = null) { |
|
104 | |||
105 | /** |
||
106 | * Get current process PID |
||
107 | * |
||
108 | * @return int |
||
109 | */ |
||
110 | 1 | public static function getPid() { |
|
115 | |||
116 | } |
||
117 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.