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 array */ |
||
27 | private $signals = [ |
||
28 | SIGTERM, |
||
29 | SIGINT, |
||
30 | ]; |
||
31 | |||
32 | /** |
||
33 | * @param array $parameter |
||
34 | */ |
||
35 | public function __construct($parameter = []) |
||
58 | |||
59 | /** |
||
60 | * this method uses master / worker model. |
||
61 | * |
||
62 | * @param callable $callable |
||
63 | * @param mixed $args |
||
64 | * @param string $tag |
||
65 | * @return void |
||
66 | * @throws \RuntimeException |
||
67 | */ |
||
68 | public function fork($callable, $args = [], $tag = null) |
||
82 | |||
83 | /** |
||
84 | * waits until all tasks that queued by Snidel::fork() are completed |
||
85 | * |
||
86 | * @return void |
||
87 | */ |
||
88 | public function wait() |
||
92 | |||
93 | /** |
||
94 | * returns generator which returns a result |
||
95 | * |
||
96 | * @return \Generator |
||
97 | */ |
||
98 | public function results() |
||
104 | |||
105 | /** |
||
106 | * @return bool |
||
107 | */ |
||
108 | public function hasError() |
||
112 | |||
113 | /** |
||
114 | * @return \Ackintosh\Snidel\Error |
||
115 | */ |
||
116 | public function getError() |
||
120 | |||
121 | public function __destruct() |
||
133 | } |
||
134 |