该程序在主函数中等待SIGCHLD,直到信号处理函数对某个全局变量进行修改后,主函数捕捉该变化,再继续运行。
该函数使用mask代替当前的信号屏蔽字,将程序挂起,直到捕获到信号,其行为要么运行一个handler,要么终止程序。
Hello from child
# Got signal from child!
the expected result would be:(the number of add
is the same as del
)
add job 12987
add job 12988
Wed Dec 19 22:20:59 CST 2018
del from 12987
Wed Dec 19 22:21:00 CST 2018
del from 12988
add job 12989
add job 12990