epoll_wait 由于 EINTR 失败,如何解决?
我的 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]
此字符串“启动计时器中的 epoll_wait 错误:测量将在整个执行期间”由我在 stderr 中打印。
我不知道如何修复这个 EINTR 以便 epoll_wait 可以工作。知道这个 EINTR 是如何由 GDB 跟踪生成的吗?
My epoll_wait fails due to EINTR. My gdb trace shows this:
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]
This string "epoll_wait error in start timer: Measurement will befor entire duration of execution" is printed by me in stderr.
I am not able to make out, how to remedy this EINTR so that epoll_wait can work. Any idea how this EINTR is generated by GDB trace?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
某些信号处理程序会中断任何 Unix 或 Linux 上的
epoll_wait()
、select()
和类似的系统调用。这是设计使然,因此您可以中断这些系统调用。您无法直接补救。典型的解决方案是显式检查 EINTR 的 errno 并再次执行
epoll_wait()
:另请参阅:gdb 错误:无法执行 epoll_wait:(4) 中断的系统调用
Certain signal handler will interrupt
epoll_wait()
,select()
and similar system calls on any Unix or Linux. This is by design so you can interrupt these system calls.You cannot directly remedy it. The typical solution is to explicitly check the errno for EINTR and to execute
epoll_wait()
again:Also see: gdb error: Unable to execute epoll_wait: (4) Interrupted system call