1 | <?php |
||
20 | class Pcntl implements Iface |
||
21 | { |
||
22 | private $max; |
||
23 | private $prio; |
||
24 | private $list = []; |
||
25 | |||
26 | |||
27 | /** |
||
28 | * Initializes the object and sets up the signal handler |
||
29 | * |
||
30 | * @param integer $max Maximum number of tasks allowed to run in parallel |
||
31 | * @param integer $prio Task priority from -20 (high) to 20 (low) |
||
32 | * @throws \Aimeos\MW\Process\Exception If setting up the signal handler failed |
||
33 | */ |
||
34 | public function __construct( $max = 4, $prio = 19 ) |
||
54 | |||
55 | |||
56 | /** |
||
57 | * Checks if processing tasks in parallel is available |
||
58 | * |
||
59 | * @return boolean True if available, false if not |
||
60 | */ |
||
61 | public function isAvailable() |
||
69 | |||
70 | |||
71 | /** |
||
72 | * Starts a new task by executing the given anonymous function |
||
73 | * |
||
74 | * @param \Closure $fcn Anonymous function to execute |
||
75 | * @param array $data List of parameters that is passed to the closure function |
||
76 | * @param boolean $restart True if the task should be restarted if it fails (only once) |
||
77 | * @return void |
||
|
|||
78 | * @throws \Aimeos\MW\Process\Exception If starting the new task failed |
||
79 | */ |
||
80 | public function start( \Closure $fcn, array $data, $restart = false ) |
||
107 | |||
108 | |||
109 | /** |
||
110 | * Waits for the running tasks until all have finished |
||
111 | * |
||
112 | * @return void |
||
113 | */ |
||
114 | public function wait() |
||
122 | |||
123 | |||
124 | /** |
||
125 | * Waits for the next running tasks to finish |
||
126 | * |
||
127 | * @return void |
||
128 | * @throws \Aimeos\MW\Process\Exception If an error occurs or the task exited with an error |
||
129 | */ |
||
130 | protected function waitOne() |
||
150 | } |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.