缓慢的系统调用和信号
Slow system call and signals
我读过这个主题:
Relationship slow system call with signal
对我来说一切都不清楚。特别是我不理解这部分答案,因为我没有看到包含的源代码有问题。
请解释一下。
提前致谢。
Anyway, back to the question. If you're wondering why the read doesn't
fail with EINTR the answer is SA_RESTART. On most Unix systems a few
system calls are automatically restarted in the event of a signal.
OP 期待 read
调用 return 错误代码,因为它被信号中断了。在 read
系统调用的情况下,OS 在出现信号时自动重新启动此系统调用,因此 return 没有错误。
我读过这个主题: Relationship slow system call with signal
对我来说一切都不清楚。特别是我不理解这部分答案,因为我没有看到包含的源代码有问题。 请解释一下。 提前致谢。
Anyway, back to the question. If you're wondering why the read doesn't fail with EINTR the answer is SA_RESTART. On most Unix systems a few system calls are automatically restarted in the event of a signal.
OP 期待 read
调用 return 错误代码,因为它被信号中断了。在 read
系统调用的情况下,OS 在出现信号时自动重新启动此系统调用,因此 return 没有错误。