(PECL ev >= 0.2.0)
EvWatcher::keepalive — Configures whether to keep the loop from returning
Configures whether to keep the loop from returning. With keepalive
value
set to false
the watcher won't keep
Ev::run()
/
EvLoop::run()
from returning even though the watcher is active.
Watchers have keepalive
value
true
by default.
Clearing keepalive status is useful when returning from Ev::run() / EvLoop::run() just because of the watcher is undesirable. It could be a long running UDP socket watcher or so.
value
With keepalive
value
set to false
the watcher won't keep
Ev::run()
/
EvLoop::run()
from returning even though the watcher is active.
Returns the previous state.
Example #1 Register an I/O watcher for some UDP socket but do not keep the event loop from running just because of that watcher.
<?php
$udp_socket = ...
$udp_watcher = new EvIo($udp_socket, Ev::READ, function () { /* ... */ });
$udp_watcher->keepalive(FALSE);
?>
Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!
Check out: eBank.nz (Art Generator) |
Netwrck.com (AI Tools) |
Text-Generator.io (AI API) |
BitBank.nz (Crypto AI) |
ReadingTime (Kids Reading) |
RewordGame |
BigMultiplayerChess |
WebFiddle |
How.nz |
Helix AI Assistant