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 array */ |
||
30 | private $signals = [ |
||
31 | SIGTERM, |
||
32 | SIGINT, |
||
33 | ]; |
||
34 | |||
35 | /** @var int */ |
||
36 | private $receivedSignal; |
||
37 | |||
38 | /** |
||
39 | * @param mixed $parameter |
||
40 | * @throws \InvalidArgumentException |
||
41 | */ |
||
42 | public function __construct($parameter = null) |
||
78 | |||
79 | /** |
||
80 | * this method uses master / worker model. |
||
81 | * |
||
82 | * @param callable $callable |
||
83 | * @param mixed $args |
||
84 | * @param string $tag |
||
85 | * @return void |
||
86 | * @throws \RuntimeException |
||
87 | */ |
||
88 | public function fork($callable, $args = [], $tag = null) |
||
104 | |||
105 | /** |
||
106 | * waits until all tasks that queued by Snidel::fork() are completed |
||
107 | * |
||
108 | * @return void |
||
109 | */ |
||
110 | public function wait() |
||
115 | |||
116 | /** |
||
117 | * returns generator which returns a result |
||
118 | * |
||
119 | * @return \Generator |
||
120 | */ |
||
121 | public function results() |
||
129 | |||
130 | /** |
||
131 | * @return bool |
||
132 | */ |
||
133 | public function hasError() |
||
137 | |||
138 | /** |
||
139 | * @return \Ackintosh\Snidel\Error |
||
140 | */ |
||
141 | public function getError() |
||
145 | |||
146 | public function setReceivedSignal($sig) |
||
150 | |||
151 | public function __destruct() |
||
168 | } |
||
169 |