Skip to content

Commit 7f35610

Browse files
committed
Add pcntl signals test
1 parent b9fc273 commit 7f35610

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

ext/pcntl/tests/async_signals_2.phpt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--TEST--
2+
Async signals in zend_call_function
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded("pcntl")) print "skip";
6+
if (getenv("SKIP_SLOW_TESTS")) print "skip slow test";
7+
?>
8+
--FILE--
9+
<?php
10+
11+
pcntl_async_signals(1);
12+
pcntl_signal(SIGALRM, function($signo) {
13+
throw new Exception("Alarm!");
14+
});
15+
16+
pcntl_alarm(1);
17+
try {
18+
array_map(
19+
'time_nanosleep',
20+
array_fill(0, 360, 1),
21+
array_fill(0, 360, 0)
22+
);
23+
} catch (Exception $e) {
24+
echo $e->getMessage(), "\n";
25+
}
26+
27+
?>
28+
--EXPECT--
29+
Alarm!

0 commit comments

Comments
 (0)