array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'tr', ), 'this' => array ( 0 => 'evwatcher.keepalive.php', 1 => 'EvWatcher::keepalive', 2 => 'Configures whether to keep the loop from returning', ), 'up' => array ( 0 => 'class.evwatcher.php', 1 => 'EvWatcher', ), 'prev' => array ( 0 => 'evwatcher.invoke.php', 1 => 'EvWatcher::invoke', ), 'next' => array ( 0 => 'evwatcher.setcallback.php', 1 => 'EvWatcher::setCallback', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ev/evwatcher/keepalive.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

EvWatcher::keepalive

(PECL ev >= 0.2.0)

EvWatcher::keepaliveConfigures whether to keep the loop from returning

Açıklama

public EvWatcher::keepalive( bool $value = ?): bool

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.

Bağımsız Değişkenler

value

With keepalive value set to false the watcher won't keep Ev::run() / EvLoop::run() from returning even though the watcher is active.

Dönen Değerler

Returns the previous state.

Örnekler

Örnek 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);
?>