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