mirror of
https://github.com/danog/amp.git
synced 2025-01-22 13:21:16 +01:00
Fix issue with the loop not terminating with only unreferenced watchers
This commit is contained in:
parent
bb1db1609f
commit
5e93318d85
@ -127,7 +127,7 @@ abstract class Driver {
|
||||
}
|
||||
}
|
||||
|
||||
$this->dispatch(empty($this->nextTickQueue) && empty($this->enableQueue) && $this->running);
|
||||
$this->dispatch(empty($this->nextTickQueue) && empty($this->enableQueue) && $this->running && !$this->isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,6 +98,16 @@ abstract class DriverTest extends TestCase {
|
||||
});
|
||||
}
|
||||
|
||||
public function testLoopTerminatesWithOnlyUnreferencedWatchers() {
|
||||
$this->start(function (Driver $loop) use (&$end) {
|
||||
$loop->unreference($loop->onReadable(STDIN, function() {}));
|
||||
$w = $loop->delay(10000000, function() {});
|
||||
$loop->defer(function() use ($loop, $w) { $loop->cancel($w); });
|
||||
$end = true;
|
||||
});
|
||||
$this->assertTrue($end);
|
||||
}
|
||||
|
||||
/** This MUST NOT have a "test" prefix, otherwise it's executed as test and marked as risky. */
|
||||
public function checkForSignalCapability() {
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user