示例#1
0
文件: Timer.php 项目: sukui/Workerman
 /**
  * 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);
         }
     }
     // Remove listener for server socket.
     self::$globalEvent->del($this->_mainSocket, EventInterface::EV_READ);
     @fclose($this->_mainSocket);
 }