PHP Doku:: Calls signal handlers for pending signals - function.pcntl-signal-dispatch.html

Verlauf / Chronik / History: (50) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzErweiterungen zur ProzesskontrolleProzesskontrollePCNTL Funktionenpcntl_signal_dispatch

Ein Service von Reinhard Neidl - Webprogrammierung.

PCNTL Funktionen

<<pcntl_setpriority

pcntl_signal>>

pcntl_signal_dispatch

(PHP 5 >= 5.3.0)

pcntl_signal_dispatchCalls signal handlers for pending signals

Beschreibung

bool pcntl_signal_dispatch ( void )

The pcntl_signal_dispatch() function calls the signal handlers installed by pcntl_signal() for each pending signal.

Rückgabewerte

Gibt bei Erfolg TRUE zurück. Im Fehlerfall wird FALSE zurückgegeben.

Beispiele

Beispiel #1 pcntl_signal_dispatch() example

<?php
echo "Installing signal handler...\n";
pcntl_signal(SIGHUP,  function($signo) {
     echo 
"signal handler called\n";
});

echo 
"Generating signal SIGHUP to self...\n";
posix_kill(posix_getpid(), SIGHUP);

echo 
"Dispatching...\n";
pcntl_signal_dispatch();

echo 
"Done\n";

?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

Installing signal handler...
Generating signal SIGHUP to self...
Dispatching...
signal handler called
Done

Siehe auch


Ein BenutzerBeitrag:
- Beiträge aktualisieren...
webmaster at ajeux dot com
10.08.2009 19:50
If you are running PHP as CLI and as a "daemon" (i.e. in a loop), this function must be called in each loop  to check if new signals are waiting dispatching.



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)