diff --git a/Inotify.php b/Inotify.php index 5cf8f5e..6baf2de 100644 --- a/Inotify.php +++ b/Inotify.php @@ -47,8 +47,10 @@ class Inotify extends BaseProcess set_exception_handler([$this, 'error']); if (!extension_loaded('inotify')) { - $this->cid = Timer::tick(1000, function () { - + Timer::tick(1000, function ($cid) { + if ($this->isStop()) { + Timer::clear($cid); + } }); return; } @@ -61,6 +63,8 @@ class Inotify extends BaseProcess public function onSigterm(): static { + $this->isStop = true; + $this->clear(); return parent::onSigterm(); // TODO: Change the autogenerated stub