summaryrefslogtreecommitdiff
path: root/ext/pcntl/tests/async_signals_2.phpt
blob: be631bab5ef35ead9aa8e1a4f79872fbf9431c50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--TEST--
Async signals in zend_call_function
--SKIPIF--
<?php
if (!extension_loaded("pcntl")) print "skip";
if (getenv("SKIP_SLOW_TESTS")) print "skip slow test";
?>
--FILE--
<?php

pcntl_async_signals(1);
pcntl_signal(SIGALRM, function($signo) {
    throw new Exception("Alarm!");
});

pcntl_alarm(1);
try {
    array_map(
        'time_nanosleep',
        array_fill(0, 360, 1),
        array_fill(0, 360, 0)
    );
} catch (Exception $e) {
    echo $e->getMessage(), "\n";
}

?>
--EXPECT--
Alarm!