Commit 37936e2b authored by Erik de Castro Lopo's avatar Erik de Castro Lopo Committed by Ben Gamari
Browse files

rts/posix/Itimer.c: Handle EINTR when reading timerfd

Commit 8626d76a added checking of the return value when reading from
the `timer_fd` and calling `sysErrorBelch` to print a warning message.
However some error causes (like EINTR) are benign and should just be

Test Plan: validate

Reviewers: hvr, austin, bgamari

Subscribers: thomie

Differential Revision:

(cherry picked from commit 7aa4c52f)
parent 1547b9cf
......@@ -202,10 +202,15 @@ static void *itimer_thread_func(void *_handle_tick)
while (1) {
if (read(timerfd, &nticks, sizeof(nticks)) != sizeof(nticks))
sysErrorBelch("Itimer: read(timer_fd) failed");
if (read(timerfd, &nticks, sizeof(nticks)) != sizeof(nticks)) {
if (errno != EINTR) {
sysErrorBelch("Itimer: read(timerfd) failed");
} else {
if (usleep(TimeToUS(itimer_interval)) != 0 && errno != EINTR) {
sysErrorBelch("usleep(TimeToUS(itimer_interval) failed");
switch (itimer_state) {
......@@ -222,7 +227,7 @@ static void *itimer_thread_func(void *_handle_tick)
return NULL;
return NULL;
return NULL; // Never reached.
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