EvWatcher::keepalive
(PECL ev >= 0.2.0)
EvWatcher::keepalive — Configures whether to keep the loop from returning
Description
$value
] )
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.
Parameters
-
value
-
With keepalive
value
set toFALSE
the watcher won't keep Ev::run() / EvLoop::run() from returning even though the watcher is active.
Return Values
Returns the previous state.
Examples
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);
?>
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для управления процессами программ
- Ev
- Функция EvWatcher::clear() - Clear watcher pending status
- Функция EvWatcher::__construct() - Abstract constructor of a watcher object
- Функция EvWatcher::feed() - Feeds the given revents set into the event loop
- Функция EvWatcher::getLoop() - Returns the loop responsible for the watcher
- EvWatcher::invoke
- Функция EvWatcher::keepalive() - Configures whether to keep the loop from returning
- Функция EvWatcher::setCallback() - Sets new callback for the watcher
- Функция EvWatcher::start() - Starts the watcher
- Функция EvWatcher::stop() - Stops the watcher
Коментарии
404 Not Found