pcntl_sigwaitinfo
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
pcntl_sigwaitinfo — 等待信号
说明
pcntl_sigwaitinfo() 函数暂停调用脚本的执行直到接收到 signals
参数中列出的某个信号。只要其中的一个信号已经在等待状态(比如:通过 pcntl_sigprocmask()
函数阻塞),pcntl_sigwaitinfo() 就回立刻返回。
参数
返回值
成功时返回信号编号, 或者在失败时返回 false
。
更新日志
版本 | 说明 |
---|---|
8.4.0 |
如果 signal 为空,则抛出 ValueError。
|
8.4.0 |
如果 signal 的值不是 int,则抛出 TypeError。
|
8.4.0 |
如果 signal 的值无效,则抛出 ValueError。
|
示例
示例 #1 pcntl_sigwaitinfo() 示例
<?php
echo "Blocking SIGHUP signal\n";
pcntl_sigprocmask(SIG_BLOCK, array(SIGHUP));
echo "Sending SIGHUP to self\n";
posix_kill(posix_getpid(), SIGHUP);
echo "Waiting for signals\n";
$info = array();
pcntl_sigwaitinfo(array(SIGHUP), $info);
?>
+添加备注
用户贡献的备注 1 note
dave at mudsite dot com ¶
8 years ago
This function is not available on platforms that do not implement the underlying C function. Included in this would be MaxOS[1], and FreeBSD[2]
[1] : http://opensource.apple.com//source/xnu/xnu-1456.1.26/bsd/sys/signal.h
[2] : http://fxr.watson.org/fxr/source/sys/signal.h?v=FREEBSD11
备份地址:http://www.lvesu.com/blog/php/function.pcntl-sigwaitinfo.php