private function stop()
{
if ($this->loop !== null && $this->loop->isRunning()) {
$this->loop->stop();
}
if ($this->stopFlags === false) {
$callable = $this->stopCallback;
$callable($this);
}
$this->stopFlags = true;
}