linux - 如果在同一个陷阱处理程序中触发信号会发生什么?
问题描述
假设我有以下 bash
chld_handler() {
trap '' CHLD # ignore while we handle
echo "$(date)" # this won't trigger chld now
trap 'chld_handler' CHLD # restore
}
# I want to be notified of the exit of any of these processes
xterm &
xterm &
xterm &
trap 'chld_handler' CHLD # first time setup
如果其中一个作业进程退出,chld_handler
被调用并且当处理程序运行另一个作业进程退出时会发生什么?第二个CHLD
信号会排队吗?
解决方案
推荐阅读
- c# - 您可以在转换为 C# 对象的 JSON 中序列化 ByteArrayContent 吗?
- html - CSS将项目与包装对齐
- php - 为什么我在尝试发送电子邮件时使用 phpmailer 收到此错误?
- python - 仅使用正则表达式匹配 2010 年以上的日期
- php - 在 Laravel 之外使用 Illuminate DB,不能使用 DB::table()
- awk - 如何在两个特定字符串之间搜索字符串并打印 string1 行、匹配的字符串行和匹配后的单个后续行(重复)
- android - 由于对象引用,MockK verifySequence 无法正常工作
- python - 如何不断重复输入语句?
- python - 检查字符串列表中是否包含特定的字母或字符(python)
- javascript - 尝试在 Javascript 中执行 Luhns 算法,但我的编程一直无限循环