Пример #1
0
 /**
  * Remove all timers.
  *
  * @return void
  */
 public static function delAll()
 {
     self::$_tasks = array();
     pcntl_alarm(0);
     if (self::$_event) {
         self::$_event->clearAllTimer();
     }
 }
Пример #2
0
 /**
  * Stop current worker instance.
  *
  * @return void
  */
 public function stop()
 {
     // Try to emit onWorkerStop callback.
     if ($this->onWorkerStop) {
         try {
             call_user_func($this->onWorkerStop, $this);
         } catch (\Exception $e) {
             echo $e;
             exit(250);
         } catch (\Error $e) {
             echo $e;
             exit(250);
         }
     }
     // Remove listener for server socket.
     self::$globalEvent->del($this->_mainSocket, EventInterface::EV_READ);
     @fclose($this->_mainSocket);
 }