@@ -79,7 +79,7 @@ |
||
79 | 79 | /** |
80 | 80 | * Binds the parameters and executes the SQL statment |
81 | 81 | * |
82 | - * @return \PDOStatement Executed PDO statement |
|
82 | + * @return \Doctrine\DBAL\Statement Executed PDO statement |
|
83 | 83 | */ |
84 | 84 | protected function exec() |
85 | 85 | { |
@@ -121,7 +121,7 @@ |
||
121 | 121 | /** |
122 | 122 | * Binds the parameters and executes the SQL statment |
123 | 123 | * |
124 | - * @return \PDOStatement Executed PDO statement |
|
124 | + * @return \Doctrine\DBAL\Driver\Statement Executed PDO statement |
|
125 | 125 | */ |
126 | 126 | protected function exec() |
127 | 127 | { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * Initializes the object |
29 | 29 | * |
30 | - * @param Aimeos\MW\Process\Iface $object Parallel processing object |
|
30 | + * @param \Aimeos\MW\Process\Iface $object Parallel processing object |
|
31 | 31 | */ |
32 | 32 | public function __construct( \Aimeos\MW\Process\Iface $object ) |
33 | 33 | { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param \Closure $fcn Anonymous function to execute |
53 | 53 | * @param array $data List of parameters that is passed to the closure function |
54 | 54 | * @param boolean $restart True if the task should be restarted if it fails (only once) |
55 | - * @return void |
|
55 | + * @return Check |
|
56 | 56 | * @throws \Aimeos\MW\Process\Exception If starting the new task failed |
57 | 57 | */ |
58 | 58 | public function start( \Closure $fcn, array $data, $restart = false ) |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | /** |
71 | 71 | * Waits for the running tasks until all have finished |
72 | 72 | * |
73 | - * @return void |
|
73 | + * @return Check |
|
74 | 74 | */ |
75 | 75 | public function wait() |
76 | 76 | { |
@@ -22,7 +22,8 @@ |
||
22 | 22 | /** |
23 | 23 | * Initializes the object |
24 | 24 | * |
25 | - * @param Aimeos\MW\Process\Iface $object Parallel processing object |
|
25 | + * @param \Aimeos\MW\Process\Iface $object Parallel processing object |
|
26 | + * @return void |
|
26 | 27 | */ |
27 | 28 | public function __construct( \Aimeos\MW\Process\Iface $object ); |
28 | 29 | } |
29 | 30 | \ No newline at end of file |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param \Closure $fcn Anonymous function to execute |
75 | 75 | * @param array $data List of parameters that is passed to the closure function |
76 | 76 | * @param boolean $restart True if the task should be restarted if it fails (only once) |
77 | - * @return void |
|
77 | + * @return null|Pcntl |
|
78 | 78 | * @throws \Aimeos\MW\Process\Exception If starting the new task failed |
79 | 79 | */ |
80 | 80 | public function start( \Closure $fcn, array $data, $restart = false ) |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | /** |
110 | 110 | * Waits for the running tasks until all have finished |
111 | 111 | * |
112 | - * @return void |
|
112 | + * @return Pcntl |
|
113 | 113 | */ |
114 | 114 | public function wait() |
115 | 115 | { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | }; |
49 | 49 | |
50 | 50 | if( pcntl_signal( SIGTERM, $handler ) === false ) { |
51 | - throw new Exception( 'Unable to install signal handler: ' . pcntl_strerror( pcntl_get_last_error() ) ); |
|
51 | + throw new Exception( 'Unable to install signal handler: '.pcntl_strerror( pcntl_get_last_error() ) ); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | if( ( $pid = pcntl_fork() ) === -1 ) { |
87 | - throw new Exception( 'Unable to fork new process: ' . pcntl_strerror( pcntl_get_last_error() ) ); |
|
87 | + throw new Exception( 'Unable to fork new process: '.pcntl_strerror( pcntl_get_last_error() ) ); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | if( $pid === 0 ) // child process |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $status = -1; |
133 | 133 | |
134 | 134 | if( ( $pid = pcntl_wait( $status ) ) === -1 ) { |
135 | - throw new Exception( 'Unable to wait for child process: ' . pcntl_strerror( pcntl_get_last_error() ) ); |
|
135 | + throw new Exception( 'Unable to wait for child process: '.pcntl_strerror( pcntl_get_last_error() ) ); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | list( $fcn, $data, $restart ) = $this->list[$pid]; |
@@ -87,13 +87,18 @@ |
||
87 | 87 | throw new Exception( 'Unable to fork new process: ' . pcntl_strerror( pcntl_get_last_error() ) ); |
88 | 88 | } |
89 | 89 | |
90 | - if( $pid === 0 ) // child process |
|
90 | + if( $pid === 0 ) { |
|
91 | + // child process |
|
91 | 92 | { |
92 | 93 | pcntl_setpriority( $this->prio ); |
94 | + } |
|
93 | 95 | |
94 | - try { |
|
96 | + try |
|
97 | + { |
|
95 | 98 | call_user_func_array( $fcn, $data ); |
96 | - } catch( \Exception $e ) { |
|
99 | + } |
|
100 | + catch( \Exception $e ) |
|
101 | + { |
|
97 | 102 | exit( 1 ); |
98 | 103 | } |
99 | 104 |
@@ -22,7 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | public function testRun() |
24 | 24 | { |
25 | - $fcn = function() { sleep( 1 ); }; |
|
25 | + $fcn = function() |
|
26 | + { |
|
27 | +sleep( 1 ); }; |
|
26 | 28 | $start = microtime( true ); |
27 | 29 | |
28 | 30 | $object = new \Aimeos\MW\Process\Pcntl(); |
@@ -36,7 +38,9 @@ discard block |
||
36 | 38 | |
37 | 39 | public function testRunException() |
38 | 40 | { |
39 | - $fcn = function() { throw new \Exception(); }; |
|
41 | + $fcn = function() |
|
42 | + { |
|
43 | +throw new \Exception(); }; |
|
40 | 44 | |
41 | 45 | $object = new \Aimeos\MW\Process\Pcntl(); |
42 | 46 |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | |
46 | 46 | public function testStart() |
47 | 47 | { |
48 | - $fcn = function() {}; |
|
48 | + $fcn = function() |
|
49 | + { |
|
50 | +}; |
|
49 | 51 | |
50 | 52 | $this->stub->expects( $this->once() )->method( 'isAvailable' ) |
51 | 53 | ->will( $this->returnValue( true ) ); |
@@ -58,7 +60,9 @@ discard block |
||
58 | 60 | |
59 | 61 | public function testStartNotAvailable() |
60 | 62 | { |
61 | - $fcn = function() {}; |
|
63 | + $fcn = function() |
|
64 | + { |
|
65 | +}; |
|
62 | 66 | |
63 | 67 | $this->stub->expects( $this->once() )->method( 'isAvailable' ) |
64 | 68 | ->will( $this->returnValue( false ) ); |
@@ -71,7 +75,9 @@ discard block |
||
71 | 75 | |
72 | 76 | public function testWait() |
73 | 77 | { |
74 | - $fcn = function() {}; |
|
78 | + $fcn = function() |
|
79 | + { |
|
80 | +}; |
|
75 | 81 | |
76 | 82 | $this->stub->expects( $this->once() )->method( 'isAvailable' ) |
77 | 83 | ->will( $this->returnValue( true ) ); |
@@ -84,7 +90,9 @@ discard block |
||
84 | 90 | |
85 | 91 | public function testWaitNotAvailable() |
86 | 92 | { |
87 | - $fcn = function() {}; |
|
93 | + $fcn = function() |
|
94 | + { |
|
95 | +}; |
|
88 | 96 | |
89 | 97 | $this->stub->expects( $this->once() )->method( 'isAvailable' ) |
90 | 98 | ->will( $this->returnValue( false ) ); |