Skip to content

Commit 91312cb

Browse files
moved timersgc foreach loop into callback
1 parent 7043031 commit 91312cb

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

LibEventLoop.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,6 @@ protected function addTimerInternal($interval, $callback, $periodic = false)
161161
throw new \InvalidArgumentException('The callback must be a callable object.');
162162
}
163163

164-
foreach ($this->timersGc as $resource) {
165-
event_free($resource);
166-
}
167-
168164
$timer = (object) array(
169165
'loop' => $this,
170166
'resource' => $resource = event_new(),
@@ -177,6 +173,9 @@ protected function addTimerInternal($interval, $callback, $periodic = false)
177173
$timer->signature = spl_object_hash($timer);
178174

179175
$callback = function () use ($timer) {
176+
foreach ($this->timersGc as $resource) {
177+
event_free($resource);
178+
}
180179
if ($timer->cancelled === false) {
181180
call_user_func($timer->callback, $timer->signature, $timer->loop);
182181

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy