mirror of
https://github.com/danog/amp.git
synced 2024-11-27 04:24:42 +01:00
094899a74b
This option determines if the watcher will keep the run() loop from returning. By default all watchers set "keep_alive" => true. Setting this value to false is ideal for registering non-crucial watchers (e.g. cache invalidation timers) that should run for the life of the program but shouldn't prevent the event loop from returning if all essential tasks have completed. <?php echo "before run\n"; run(function () { immediately(function () { echo "immediately\n"; }); once(function () { echo "once\n"; }, 100, ["keep_alive" => false]); repeat(function () { echo "repeat\n"; }, 500, ["keep_alive" => false]); echo "onStart end\n"; }); echo "after run\n"; The above snippet will have the following output: before run immediately after run The Amp\info() function now also reports the number of keep_alive watchers currently registered via the "keep_alive" key. |
||
---|---|---|
.. | ||
bootstrap.php | ||
EvReactorTest.php | ||
FailureTest.php | ||
FunctionsTest.php | ||
LibeventReactorTest.php | ||
NativeReactorTest.php | ||
PauseTest.php | ||
PlaceholderPrivateTest.php | ||
PlaceholderPublicTest.php | ||
PlaceholderTest.php | ||
PromisorPrivateTest.php | ||
PromisorPublicTest.php | ||
PromisorTest.php | ||
ReactorTest.php | ||
StructTest.php | ||
SuccessTest.php | ||
UvReactorTest.php |