[Babel-users] [PATCH 2/3] Introduce taskqueue for easier tasks and timeout handling

Antonin Décimo antonin.decimo at gmail.com
Sat Dec 22 18:25:08 GMT 2018


>> I happen to really like timerfds but they are a linuxism.
> How would they be used here?

>From what I understand, after having used timerfd for a small “projet
de réseau”…

Instead of what babeld is currently doing:

struct timeval tv;
gettime(&now);
timeval_min(&tv, &some_timer);
select(maxfd + 1, &readfds, NULL, NULL, &tv);


You create a file descriptor for each new timer. You can chose which
clock to use, and if the timer should fire periodically, or at some
defined later time. The fd can be monitored with select. When the
timer expires, it generates some kind of read event and select exits.
A timerfd can be re-armed after it expires, it’s reusable.

The API is quite minimalistic. Of course, it’s all managed by the
kernel. timerfd_create, timerfd_settime, timerfd_gettime.


LWN and the manual are my sources.
A quick grep shows that libev does not use timerfd, but libevent does.

-- Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/babel-users/attachments/20181222/89fcd935/attachment.html>


More information about the Babel-users mailing list