/** * Dispose of all watchers and reset all resources allocated by the loop. * * This method will be called after each async test run in order to free resources. */ public function reset() { $this->config->getPool()->shutdown(); foreach ($this->watchers as $watcher) { switch ($watcher->type) { case Watcher::TYPE_DEFER: unset($this->deferred[$watcher->id]); break; case Watcher::TYPE_DELAY: $this->disableDelayWatcher($watcher, true); break; case Watcher::TYPE_REPEAT: $this->disableRepeatWatcher($watcher, true); break; case Watcher::TYPE_READ: $this->disableReadWatcher($watcher, true); break; case Watcher::TYPE_WRITE: $this->disableWriteWatcher($watcher, true); break; case Watcher::TYPE_SIGNAL: $this->disableSignalWatcher($watcher, true); break; } } $this->running = 0; $this->watchers = []; $this->enable = []; $this->deferred = []; $this->info = \array_fill(0, 12, 0); }