1 && function_exists('pcntl_fork') && function_exists('pcntl_waitpid')) { // This array will keep a dictionary of subprocesses. $pids = []; // The database connection must be closed before forking. Rhymix\Framework\DB::getInstance()->disconnect(); Rhymix\Framework\Debug::disable(); // Create the required number of subprocesses. for ($i = 0; $i < $process_count; $i++) { $pid = pcntl_fork(); if ($pid > 0) { $pids[$pid] = true; usleep(200000); } elseif ($pid == 0) { Rhymix\Framework\Queue::process($i, $process_count, $timeout); exit; } else { error_log('RxQueue: could not fork!'); exit; } } // The parent process waits for its children to finish. while (count($pids) && !Rhymix\Framework\Queue::signalReceived()) { $pid = pcntl_waitpid(-1, $status, \WNOHANG); if ($pid) { unset($pids[$pid]); } usleep(200000); } } else { Rhymix\Framework\Queue::process(0, 1, $timeout); } // If called over the network, display a simple OK message to indicate success. if (PHP_SAPI !== 'cli') { echo "OK\n"; }