File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
/**
4
4
* Run the script indefinitely seconds with the loop from the factory and report every 2 seconds:
5
- * php test -memory.php
5
+ * php 95-benchmark -memory.php
6
6
* Run the script for 30 seconds with the stream_select loop and report every 10 seconds:
7
- * php test -memory.php -t 30 -l StreamSelect -r 10
7
+ * php 95-benchmark -memory.php -t 30 -l StreamSelect -r 10
8
8
*/
9
9
10
10
use React \EventLoop \Factory ;
26
26
$ runs = 0 ;
27
27
28
28
if (5 < $ t ) {
29
- $ loop ->addTimer ($ t , function (TimerInterface $ timer ) {
30
- $ timer -> getLoop () ->stop ();
29
+ $ loop ->addTimer ($ t , function () use ( $ loop ) {
30
+ $ loop ->stop ();
31
31
});
32
32
33
33
}
34
34
35
35
$ loop ->addPeriodicTimer (0.001 , function () use (&$ runs , $ loop ) {
36
36
$ runs ++;
37
37
38
- $ loop ->addPeriodicTimer (1 , function (TimerInterface $ timer ) {
39
- $ timer -> cancel ( );
38
+ $ loop ->addPeriodicTimer (1 , function (TimerInterface $ timer ) use ( $ loop ) {
39
+ $ loop -> cancelTimer ( $ timer );
40
40
});
41
41
});
42
42
You can’t perform that action at this time.
0 commit comments