Commit df4ef3b9 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland Committed by Lasse Karstensen

Restart epoll_wait on EINTR error

This works around a Linux kernel bug where the epoll_wait will return
EINTR when the process is subjected to a ptrace or the OS wakes from
suspend.

Fixes: #1763
parent 0cf12629
......@@ -38,6 +38,7 @@
#include <sys/epoll.h>
#include <stdlib.h>
#include <errno.h>
#include "cache/cache.h"
......@@ -110,7 +111,12 @@ vwe_thread(void *priv)
i = (int)ceil(1e3 * then);
assert(i > 0);
Lck_Unlock(&vwe->mtx);
n = epoll_wait(vwe->epfd, ev, NEEV, i);
do {
/* Due to a linux kernel bug, epoll_wait can
return EINTR when the process is subjected to
ptrace or waking from OS suspend. */
n = epoll_wait(vwe->epfd, ev, NEEV, i);
} while (n < 0 && errno == EINTR);
assert(n >= 0);
assert(n <= NEEV);
now = VTIM_real();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment