eloop: make timerfd non-blocking

We actually allow draining a timer so we cannot be sure that a timer has
valid data that we can read. We already handle the non-blocking case
everywhere, we just missed setting this flag.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-09-27 14:29:33 +02:00
parent f391ee24aa
commit 182d8a8145

View File

@ -1540,7 +1540,7 @@ int ev_timer_new(struct ev_timer **out, const struct itimerspec *spec,
timer->cb = cb;
timer->data = data;
timer->fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
timer->fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
if (timer->fd < 0) {
llog_error(timer, "cannot create timerfd (%d): %m", errno);
ret = -EFAULT;