1 | <?php |
||
12 | class Snidel |
||
13 | { |
||
14 | /** @var \Ackintosh\Snidel\Config */ |
||
15 | private $config; |
||
16 | |||
17 | /** @var \Ackintosh\Snidel\Fork\Container */ |
||
18 | private $container; |
||
19 | |||
20 | /** @var \Ackintosh\Snidel\Pcntl */ |
||
21 | private $pcntl; |
||
22 | |||
23 | /** @var \Ackintosh\Snidel\Log */ |
||
24 | private $log; |
||
25 | |||
26 | /** @var bool */ |
||
27 | private $joined = false; |
||
28 | |||
29 | /** @var int */ |
||
30 | private $ownerPid; |
||
31 | |||
32 | /** @var array */ |
||
33 | private $signals = [ |
||
34 | SIGTERM, |
||
35 | SIGINT, |
||
36 | ]; |
||
37 | |||
38 | /** @var int */ |
||
39 | private $receivedSignal; |
||
40 | |||
41 | /** |
||
42 | * @param mixed $parameter |
||
43 | * @throws \InvalidArgumentException |
||
44 | */ |
||
45 | public function __construct($parameter = null) |
||
82 | |||
83 | /** |
||
84 | * this method uses master / worker model. |
||
85 | * |
||
86 | * @param callable $callable |
||
87 | * @param mixed $args |
||
88 | * @param string $tag |
||
89 | * @return void |
||
90 | * @throws \RuntimeException |
||
91 | */ |
||
92 | public function fork($callable, $args = [], $tag = null) |
||
108 | |||
109 | /** |
||
110 | * waits until all tasks that queued by Snidel::fork() are completed |
||
111 | * |
||
112 | * @return void |
||
113 | */ |
||
114 | public function wait() |
||
119 | |||
120 | /** |
||
121 | * @return bool |
||
122 | */ |
||
123 | public function hasError() |
||
127 | |||
128 | /** |
||
129 | * @return \Ackintosh\Snidel\Error |
||
130 | */ |
||
131 | public function getError() |
||
135 | |||
136 | /** |
||
137 | * gets results |
||
138 | * |
||
139 | * @param string $tag |
||
140 | * @return \Ackintosh\Snidel\Result\Collection |
||
141 | * @throws \InvalidArgumentException |
||
142 | */ |
||
143 | public function get($tag = null) |
||
154 | |||
155 | public function setReceivedSignal($sig) |
||
159 | |||
160 | public function __destruct() |
||
177 | } |
||
178 |