File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / pcntl / tests / signal_closure_handler.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:59 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Closures as a signal handler
--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
declare (ticks = 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!

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>