mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00

Squashed commit of the following: commiteda931df18
Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Jul 6 10:53:30 2016 +0300 Replace pcntl.async_signals INI direcrive with pcntl_async_signals() function. commitbfbf7dd7c2
Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jun 24 12:25:31 2016 +0300 Asynchronous signal handling without TICKs.
25 lines
641 B
PHP
25 lines
641 B
PHP
--TEST--
|
|
Asynchronous signal handling through VM interrupts
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded("pcntl")) print "skip";
|
|
elseif (!function_exists("pcntl_signal")) print "skip pcntl_signal() not available";
|
|
elseif (!function_exists("posix_kill")) print "skip posix_kill() not available";
|
|
elseif (!function_exists("posix_getpid")) print "skip posix_getpid() not available";
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
pcntl_async_signals(1);
|
|
|
|
pcntl_signal(SIGTERM, function ($signo) { echo "Signal handler called!\n"; });
|
|
|
|
echo "Start!\n";
|
|
posix_kill(posix_getpid(), SIGTERM);
|
|
$i = 0; // dummy
|
|
echo "Done!\n";
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Start!
|
|
Signal handler called!
|
|
Done!
|