1
0
mirror of https://github.com/danog/amp.git synced 2024-11-27 04:24:42 +01:00

gc just to be safe prior to run loop exit

This commit is contained in:
Daniel Lowrey 2015-08-06 14:37:08 -04:00
parent 39d3212fb0
commit ad4831888f
4 changed files with 10 additions and 2 deletions

View File

@ -111,6 +111,8 @@ class EvReactor implements Reactor {
$this->loop->run($flags);
}
\gc_collect_cycles();
$this->state = self::STOPPED;
if ($this->stopException) {
$e = $this->stopException;

View File

@ -92,6 +92,8 @@ class LibeventReactor implements Reactor {
\event_base_loop($this->keepAliveBase, $flags);
}
\gc_collect_cycles();
$this->state = self::STOPPED;
if ($this->stopException) {
$e = $this->stopException;

View File

@ -73,6 +73,8 @@ class NativeReactor implements Reactor {
}
}
\gc_collect_cycles();
$this->timersEnabled = false;
$this->state = self::STOPPED;
}

View File

@ -93,6 +93,8 @@ class UvReactor implements Reactor {
\uv_run($this->loop, \UV::RUN_DEFAULT | (empty($this->immediates) ? \UV::RUN_ONCE : \UV::RUN_NOWAIT));
}
\gc_collect_cycles();
$this->state = self::STOPPED;
if ($this->stopException) {
$e = $this->stopException;
@ -134,7 +136,7 @@ class UvReactor implements Reactor {
"Cannot tick() recursively; event reactor already active"
);
}
$this->state = self::TICKING;
$noWait = (bool) $noWait;
@ -144,7 +146,7 @@ class UvReactor implements Reactor {
break;
}
}
// 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;