diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 00000000..d4cd224b --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,13 @@ +# dev + +- n/a + +### 1.0.1 + +- Fix bug preventing UvReactor::tick() from returning when no + events are ready for a single active IO watcher. + +1.0.0 +----- + +- Initial stable API release diff --git a/lib/UvReactor.php b/lib/UvReactor.php index 343bb607..027c7596 100644 --- a/lib/UvReactor.php +++ b/lib/UvReactor.php @@ -90,7 +90,8 @@ public function run(callable $onStart = null) { if (empty($this->keepAliveCount) || $this->state <= self::STOPPED) { break; } - \uv_run($this->loop, \UV::RUN_DEFAULT | (empty($this->immediates) ? \UV::RUN_ONCE : \UV::RUN_NOWAIT)); + $flags = \UV::RUN_ONCE | ($this->immediates ? \UV::RUN_NOWAIT : 0); + \uv_run($this->loop, $flags); } \gc_collect_cycles(); @@ -148,8 +149,8 @@ public function tick($noWait = false) { } // Check the conditional again because a manual stop() could've changed the state - if ($this->state) { - $flags = $noWait || !empty($this->immediates) ? (\UV::RUN_NOWAIT | \UV::RUN_ONCE) : \UV::RUN_ONCE; + if ($this->state > 0) { + $flags = ($noWait || $this->immediates) ? (\UV::RUN_DEFAULT | \UV::RUN_NOWAIT) : \UV::RUN_ONCE; \uv_run($this->loop, $flags); }