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:
parent
f391ee24aa
commit
182d8a8145
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user