multithreading.php
changeset 53 a6b339665650
parent 48 d643bfb862d8
child 68 32f6e2ee15ab
--- 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;
     }
   }