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:
parent
5374d7cce2
commit
b7a54c1691
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user