PHP 8.3.21 Released!

EvSignal::__construct

(PECL ev >= 0.2.0)

EvSignal::__constructConstruye un objeto watcher EvSignal

Descripción

public EvSignal::__construct(
     int $signum ,
     callable $callback ,
     mixed $data = null ,
     int $priority = 0
)

Construye un objeto watcher EvSignal y lo inicia automáticamente. Para un watcher periódico detenido, utilice en su lugar el método EvSignal::createStopped().

Parámetros

signum

Número de la señal. Consulte las constantes exportadas por la extensión pcntl. Consulte también la página del manual del sistema signal(7).

callback

Consulte las funciones de retrollamada de los Watchers.

data

Datos personalizados para asociar con el watcher.

priority

Prioridad del Watcher

Ejemplos

Ejemplo #1 Gestión de una señal SIGTERM

<?php
$w
= new EvSignal(SIGTERM, function ($watcher) {
echo
"¡Señal SIGTERM recibida!\n";
$watcher->stop();
});

Ev::run();
?>

Ver también

add a note

User Contributed Notes

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