diff --git a/Inotify.php b/Inotify.php index 080a33f..7670fe3 100644 --- a/Inotify.php +++ b/Inotify.php @@ -97,15 +97,13 @@ class Inotify extends BaseProcess $this->watch($dir); } Event::add($this->inotify, [$this, 'check']); - while (true) { + Event::cycle(function () { if ($this->isStop()) { Event::del($this->inotify); - break; } - Event::dispatch(); - - usleep(100 * 1000); - } + Event::exit(); + }, true); + Event::wait(); }