1
0
mirror of https://github.com/danog/file.git synced 2024-11-29 20:09:10 +01:00

Don't store a loop reference in poll objects

Now we no longer have a circular reference there.
This commit is contained in:
Niklas Keller 2017-06-21 22:35:08 +02:00
parent 5374d7cce2
commit b7a54c1691
2 changed files with 2 additions and 6 deletions

View File

@ -39,15 +39,13 @@ class EioPoll {
Loop::setState(self::class, new class($this->watcher) {
private $watcher;
private $driver;
public function __construct(string $watcher) {
$this->watcher = $watcher;
$this->driver = Loop::get();
}
public function __destruct() {
$this->driver->cancel($this->watcher);
Loop::cancel($this->watcher);
// Ensure there are no active operations anymore. This is a safe-guard as some operations might not be
// finished on loop exit due to not being yielded. This also ensures a clean shutdown for these if PHP

View File

@ -29,15 +29,13 @@ class UvPoll {
Loop::setState(self::class, new class($this->watcher) {
private $watcher;
private $driver;
public function __construct(string $watcher) {
$this->watcher = $watcher;
$this->driver = Loop::get();
}
public function __destruct() {
$this->driver->cancel($this->watcher);
Loop::cancel($this->watcher);
}
});
}