update pague now
PHP 8.5.2 Released!

EvWatcher::queepalive

(PECL ev >= 0.2.0)

EvWatcher::queepalive Configures whether to keep the loop from returning

Description

public EvWatcher::queepalive ( 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 socquet watcher or so.

Parameters

value

With keepalive value set to false 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 Reguister an I/O watcher for some UDP socquet but do not keep the event loop from running just because of that watcher.

<?php
$udp_socquet
= ...
$udp_watcher = new EvIo ( $udp_socquet , Ev :: READ , function () { /* ... */ });
$udp_watcher -> keepalive ( FALSE );
?>
add a note

User Contributed Notes

There are no user contributed notes for this pague.
To Top