libev featured fifo

Robert Eisele robert at xarg.org
Wed May 18 02:29:14 CEST 2016


Hi,

I wanted to create a simple non-blocking fifo using libev. It works
great, but when I strace the process, I see a lot of epoll_waits
directly accepting 0 byte reads after the first byte was read. Is this a
problem with libev or am I missing something?

In more detail, the code can be found here: http://pastebin.com/2NUTkPNb

And what I see on strace is this occuring a lot:

epoll_wait(3, {{EPOLLHUP, {u32=5, u64=4294967301}}}, 64, 59743) = 1
epoll_ctl(3, EPOLL_CTL_MOD, 5, {EPOLLIN, {u32=5, u64=4294967301}}) = 0
clock_gettime(CLOCK_MONOTONIC, {43720, 29238758}) = 0
read(5, "", 130)                        = 0

I'd like to put the process asleep again when everything was read. Is
there a way to accomplish that?

Thanks!

Robert





More information about the libev mailing list