The first way is to install a signal handler for the SIGBUS signal, and then simply call return in the handler.
第一种方式是为SIGBUS信号设置信号处理程序,并在处理程序中简单的执行return语句。
Your write system call will be interrupted by the bus error signal SIGBUS, because you performed a bad memory access.
此时write系统调用会被进程接收到的SIGBUS信号中断,因为当前进程访问了非法内存地址。
Or, you call some function that was in the middle of the manipulation of the global data structure and you call the same function from the signal handler.
或者,调用了正在处理全局数据结构的某个函数,而在信号处理器中又调用了同一个函数。
应用推荐