Signal Handling--ref
/ Establish the signal handler. / / Create the child process. / / Busy wait for the child to send a signal. / / Now continue execution. / return 0;
SIG_IGN. But it is useful to block signals briefly,to prevent them from interrupting sensitive operations. For instance:
sigprocmask function to block signals while you modify global variables that are also modified by the handlers for these signals.
sigprocmaskgives you a way to prevent interrupts during critical parts of your code. If signals arrive in that part of the program,they are delivered later,after you unblock them. sig_atomic_t(see section),then the signal handler could run when the rest of the program has only half finished reading or writing the data. This would lead to confusing consequences.
sig_atomic_t; you would like to test the flag and perform the action if the flag is not set. This is unreliable. Suppose the signal is delivered immediately after you test the flag,but before the consequent action: then the program will perform the action even though the signal has arrived.
`signal.h'.
|
- linux – MongoDB进程每天都在关闭.怎么在服务器上永远运行
- iPhone6好用吗 浅谈2.5D屏幕的现状与发展
- 拍大师怎么用 拍大师给视频添加陈欧体文字字幕特效教程
- 支付宝估值在哪里 支付宝估值功能演示
- linux – flock(1)无法释放锁定
- ios7怎么同步itunes
- macos – 无法在Zsh中完成MacPorts的选项卡
- killbackground怎么设置,killbackground使用教程
- linux – 如何在CentOS 5.10上为已安装的STUNNEL创建服务
- install keepalived on RedHat/CentOS to provide IP failo