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($timeout); exit; } else { error_log('RxQueue: could not fork!'); exit; } } // The parent process waits for its children to finish. while (count($pids)) { $pid = pcntl_waitpid(-1, $status, \WNOHANG); if ($pid) { unset($pids[$pid]); } usleep(200000); } } else { Rhymix\Framework\Queue::process($timeout); }