xref: /PHP-8.0/ext/pcntl/tests/003.phpt (revision da3a807f)
1--TEST--
2pcntl: SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK
3--SKIPIF--
4<?php
5    if (!extension_loaded('pcntl')) die('skip pcntl extension not available');
6    elseif (!extension_loaded('posix')) die('skip posix extension not available');
7    elseif (!function_exists('pcntl_sigwaitinfo') or !function_exists('pcntl_sigtimedwait')) die('skip required functionality is not available');
8?>
9--FILE--
10<?php
11
12// Clear mask
13pcntl_sigprocmask(SIG_SETMASK, array(), $prev);
14
15pcntl_sigprocmask(SIG_BLOCK, array(SIGCHLD,SIGTERM), $old);
16var_dump(count($old));
17pcntl_sigprocmask(SIG_BLOCK, array(SIGINT), $old);
18var_dump(count($old));
19pcntl_sigprocmask(SIG_UNBLOCK, array(SIGINT), $old);
20var_dump(count($old));
21pcntl_sigprocmask(SIG_SETMASK, array(SIGINT), $old);
22var_dump(count($old));
23pcntl_sigprocmask(SIG_SETMASK, array(), $old);
24var_dump(count($old));
25
26// Restore previous mask
27pcntl_sigprocmask(SIG_SETMASK, $prev, $old);
28var_dump(count($old));
29
30?>
31--EXPECT--
32int(0)
33int(2)
34int(3)
35int(2)
36int(1)
37int(0)
38