Fixed broken FORK_CHILD usage.
--- a/multithreading.php Wed Sep 24 00:18:21 2008 -0400
+++ b/multithreading.php Wed Sep 24 13:47:23 2008 -0400
@@ -130,12 +130,15 @@
{
global $threader_instances;
- declare(ticks=1);
-
- $threader_instances[] =& $this;
-
- pcntl_signal(SIGUSR2, 'Threader_SigUsr2');
- pcntl_signal(SIGCHLD, 'Threader_SigChld');
+ if ( function_exists('pcntl_signal') )
+ {
+ declare(ticks=1);
+
+ $threader_instances[] =& $this;
+
+ pcntl_signal(SIGUSR2, 'Threader_SigUsr2');
+ pcntl_signal(SIGCHLD, 'Threader_SigChld');
+ }
$this->json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
$this->parent_pid = getmypid();
@@ -170,7 +173,7 @@
fclose($socket_pair[1]);
$this->parent_sock = $socket_pair[0];
$this->is_child = true;
- return FORK_CHILD;
+ return self::FORK_CHILD;
}
}
--- a/webserver.php Wed Sep 24 00:18:21 2008 -0400
+++ b/webserver.php Wed Sep 24 13:47:23 2008 -0400
@@ -508,7 +508,7 @@
// fork off if possible
if ( function_exists('pcntl_fork') && $this->allow_fork && !$this->in_keepalive )
{
- if ( $this->threader->fork() == FORK_CHILD )
+ if ( $this->threader->fork() == Threader::FORK_CHILD )
{
// this is the child
define('HTTPD_WS_CHILD', 1);