我的 epoll_wait 由于 EINTR 失败。我的 gdb 跟踪显示了这一点:
enter code here
221 in ../nptl/sysdeps/pthread/createthread.c
(gdb)
224 in ../nptl/sysdeps/pthread/createthread.c
(gdb)
[New Thread 0x40988490 (LWP 3589)]
227 in ../nptl/sysdeps/pthread/createthread.c
(gdb)
epoll_wait error in start timer: Measurement will befor entire duration of execution
epoll_wait: Interrupted system call
[Thread 0x40988490 (LWP 3589) exited]
我在 stderr 中打印了这个字符串“启动计时器中的 epoll_wait 错误:测量将在整个执行期间进行”。
我不知道如何修复这个 EINTR 以便 epoll_wait 可以工作。知道这个 EINTR 是如何由 GDB 跟踪生成的吗?
某些信号处理程序会中断epoll_wait()
, select()
以及任何 Unix 或 Linux 上的类似系统调用。这是设计使然,因此您可以中断这些系统调用。
您无法直接补救。典型的解决方案是显式检查 errno 中的 EINTR 并执行epoll_wait()
again:
int nr;
do {
nr = epoll_wait(epfd, events, maxevents, timeout);
} while (nr < 0 && errno == EINTR);
另请参阅:gdb错误:无法执行epoll_wait:(4)中断的系统调用 https://stackoverflow.com/questions/2252981/gdb-error-unable-to-execute-epoll-wait-4-interrupted-system-call
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)