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. |
||
---|---|---|
.. | ||
CoroutineResult.php | ||
CoroutineState.php | ||
Deferred.php | ||
EvReactor.php | ||
Failure.php | ||
functions.php | ||
LibeventReactor.php | ||
NativeReactor.php | ||
Pause.php | ||
Placeholder.php | ||
PrivatePlaceholder.php | ||
PrivatePromisor.php | ||
Promise.php | ||
Promisor.php | ||
PublicPromisor.php | ||
Reactor.php | ||
Struct.php | ||
Success.php | ||
UvReactor.php | ||
Watcher.php |