function run_server($time = 1, $log_file = null) { $filelog = new FileLog($log_file); while (true) { $event = $this->_queue->get(); if ($event and !isset($event['HTTPSQS_GET_END'])) { if (!isset($this->_handles[$event[0]])) { $filelog->info('SwooleEvent Error: empty event!'); } $func = $this->_handles[$event[0]]; if (!function_exists($func)) { $filelog->info('SwooleEvent Error: event handle function not exists!'); } else { $parmas = array_slice($event, 1); call_user_func_array($func, $parmas); $filelog->info('SwooleEvent Info: process success!event type ' . $func . ',params(' . implode(',', $parmas) . ')'); } } else { usleep($time * 1000); //echo 'sleep',NL; } } }