1--TEST--
2pcnt_signal_dispatch()
3--SKIPIF--
4<?php
5    if (!extension_loaded("pcntl")) print "skip";
6    elseif (!function_exists("pcntl_signal")) print "skip pcntl_signal() not available";
7    elseif (!function_exists("pcntl_signal_dispatch")) print "skip pcntl_signal_dispatch() not available";
8    elseif (!function_exists("posix_kill")) print "skip posix_kill() not available";
9    elseif (!function_exists("posix_getpid")) print "skip posix_getpid() not available";
10?>
11--FILE--
12<?php
13
14pcntl_signal(SIGTERM, function ($signo) { echo "Signal handler called!\n"; });
15
16echo "Start!\n";
17posix_kill(posix_getpid(), SIGTERM);
18$i = 0; // dummy
19pcntl_signal_dispatch();
20echo "Done!\n";
21
22?>
23--EXPECT--
24Start!
25Signal handler called!
26Done!
27