Example #1
0
pcntl_signal(SIGALRM, SIG_IGN);
pcntl_signal(SIGINT, SIG_IGN);
pcntl_signal(SIGUSR1, SIG_IGN);
pcntl_signal(SIGUSR2, SIG_IGN);
pcntl_signal(SIGHUP, SIG_IGN);
pcntl_signal(SIGCHLD, "sig_handler");
pcntl_signal_dispatch();
while (true) {
	$child++;
	$pid = pcntl_fork();
	if ($pid) {
		echo 'starting new child'."\n";
		if ($child >= $max) {
			pcntl_wait($status);
		}
		
	}
	else{
		while (true) {
			$robot = new reply();
			$robot->connect();
			$robot->getSource();
			$robot->close();
			sleep(2);
			echo "query come \n";
		}
	}
}