@@ -724,7 +724,7 @@ public function __construct()
724724 self ::$ parent_pid = getmypid ();
725725
726726 // install signal handlers
727- declare (ticks = 1 );
727+ pcntl_async_signals ( true );
728728 pcntl_signal (SIGHUP , array (&$ this , 'signal_handler_sighup ' ));
729729 pcntl_signal (SIGCHLD , array (&$ this , 'signal_handler_sigchild ' ));
730730 pcntl_signal (SIGTERM , array (&$ this , 'signal_handler_sigint ' ));
@@ -809,7 +809,7 @@ public function signal_handler_sighup($signal_number)
809809 public function signal_handler_sigchild ($ signal_number )
810810 {
811811 // do not allow signals to interrupt this
812- declare (ticks = 0 )
812+ pcntl_async_signals ( false );
813813 {
814814 // reap all child zombie processes
815815 if (self ::$ parent_pid == getmypid ())
@@ -1271,7 +1271,7 @@ public function helper_process_spawn($function_name, array $arguments = array(),
12711271 list ($ socket_child , $ socket_parent ) = $ this ->ipc_init ();
12721272
12731273 // do not process signals while we are forking
1274- declare (ticks = 0 );
1274+ pcntl_async_signals ( false );
12751275 $ pid = pcntl_fork ();
12761276
12771277 if ($ pid == -1 )
@@ -1287,7 +1287,7 @@ public function helper_process_spawn($function_name, array $arguments = array(),
12871287 // set child properties
12881288 $ this ->child_bucket = self ::DEFAULT_BUCKET ;
12891289
1290- declare (ticks = 1 );
1290+ pcntl_async_signals ( true );
12911291
12921292 // close our socket (we only need the one to the parent)
12931293 socket_close ($ socket_child );
@@ -1306,7 +1306,7 @@ public function helper_process_spawn($function_name, array $arguments = array(),
13061306 * Parent process
13071307 */
13081308
1309- declare (ticks = 1 );
1309+ pcntl_async_signals ( true );
13101310 $ this ->log ('Spawned new helper process with pid ' . $ pid , self ::LOG_LEVEL_INFO );
13111311
13121312 // close our socket (we only need the one to the child)
@@ -1775,7 +1775,7 @@ protected function fork_work_unit(array $work_unit, $identifier = '', $bucket =
17751775 list ($ socket_child , $ socket_parent ) = $ this ->ipc_init ();
17761776
17771777 // turn off signals temporarily to prevent a SIGCHLD from interupting the parent before $this->forked_children is updated
1778- declare (ticks = 0 );
1778+ pcntl_async_signals ( false );
17791779
17801780 // spoon!
17811781 $ pid = pcntl_fork ();
@@ -1807,7 +1807,7 @@ protected function fork_work_unit(array $work_unit, $identifier = '', $bucket =
18071807 $ this ->forked_children_count ++;
18081808
18091809 // turn back on signals now that $this->forked_children has been updated
1810- declare (ticks = 1 );
1810+ pcntl_async_signals ( true );
18111811
18121812 // close our socket (we only need the one to the child)
18131813 socket_close ($ socket_parent );
@@ -1833,7 +1833,7 @@ protected function fork_work_unit(array $work_unit, $identifier = '', $bucket =
18331833 $ this ->child_bucket = $ bucket ;
18341834
18351835 // turn signals on for the child
1836- declare (ticks = 1 );
1836+ pcntl_async_signals ( true );
18371837
18381838 // close our socket (we only need the one to the parent)
18391839 socket_close ($ socket_child );
0 commit comments